I love BooguNote very much (it's a Sharp tool for collecting and organizing information scraps) But what a pity it just run under windows currently.
I tried to build a Java version for BooguNote so I can run it under linux (first step: I want to just make a simple BooguViewer ) since I'm not very familiar with so huge Java libraries, so I ask for help who know the suitable Java tree component in this case.
My requirement is this:
it's not an usual tree component, as you can check from the BooguNote's screenshot as below:
http://boogu.me/en.jpg
Usual tree is used as an outline, but in BooguNote, tree node was used as a content container at the same time - you can even save a huge text in it! (I heard the author said in the forum before he used "Windowless Richedit Control" technology).
Any advices are welcome, Thanks in advance.
This Oracle tutorial tells you how to create graphical user interfaces (GUIs) for applications and applets, using the Java Swing components.
Start with the Using Swing Components tutorial. Go through the following top-level lessons:
Using Top-Level Containers
The JComponent Class
Using Text Components
Go through the following component lessons:
How to Make Frames (Main Windows)
How to Use Panels
How to Use Trees
The Swing components that you want to use to make a viewer are JFrame, JPanel, and JTree.
Related
I've read several things about Scenes vs Panes / StackPanes in JavaFX. I'm just having a hard time determining if there is an "industry standard". Primarily, I'm wanting to go from Login -> Dashboard -> Other "screens". Is there a preferred / standard for this with regards to scenes vs stackpane? I understand if this question gets closed because of "opinion based" but I'm technically not looking for an opinion; I'm looking for the standard by which JavaFX Applications should be architected.
AFAIK there's no standard coming from JavaFX core nor any set of guidelines for that matter.
Back in the Swing days we used to rely on CardPane to attain the desired behavior. Sadly JavaFX core does not provide such container/component out of the box. One could write up a similar container based on StackPane (the trick is to make sure children nodes in the back layers are hidden from view).
Switching scenes as you mention appears to be a popular option too, although I prefer changing the root of the scene instead o switching the whole thing completely.
finally, building a medium to large sized JavaFX application most likely requires an application framework of some sort. Again JavaFX core delivers no support in this regard besides the very basic application lifecycle provided by the Application class. My suggestion is to have a look at https://github.com/mhrimaz/AwesomeJavaFX#frameworks and evaluate those options depending on your specific requirements. I'm biased but I'd suggest you to have a look at http://griffon-framework.org/. In all fairness Griffon doesn't enforce a particular strategy that can answer your question, but the recent additions to its JavaFX support should make it simpler to implement a CardPane. Perhaps that's what we'll do for the next release :-)
I think it really depends on the nature of your application. Ie., is it a single visible window that changes content depending on your activity (e.g., something like Windows calculator that can change mode), or an editor-like main window with tabbed panes, or a "tool" application like an image editor with a main view and separate child panes.
For your use case I would just switch out the root node property of your main Scene object. So you would have a "Dashboard" root node, and when you click/select something on the dashboard you just update the root node property with the new node to display.
I'm new to the world of C# automation so apologies if this is obvious. My colleagues and I work frequently within an app written in Java, and I'm looking to automate some of the tasks. However, I can't seem to identify any of the elements (various menus, textboxes, etc.) within the Java windows using the tools I'm aware of (Inspect and Spy++). Nothing within the main "window" of the app shows up in Inspect (just the title bar and its' children).
I've gotten the automation working by using P/Invoke SendInput commands to click on the various parts of the window I need to click on (based on x/y coordinates) and enter text as if it's coming from the keyboard. However, this seems a bit ... fiddly. I'd feel better using this if I could formalize element names instead of just sending mouseclick instructions via code, is there a way to do this? For example with something like the Windows.Automation library when I don't have the element IDs?
TestStack.White framework written in C# should help you. It's based on UI Automation API and should see any lightweight controls like WPF ones.
I created a program with a Swing GUI in NetBeans a while back using the Graphical Editor. I now needed a web version but since I use eclipse now I copied + pasted the code into a new Web Applet project. I found some problems I didn't spot before and updated the code in the web applet.
I want to add some buttons to the GUI, but one problem is its an annoyance to find the part of the code where NetBeans put all the variable declarations, then find another part of the code where all the fields are initialised, then find the other part of the code where the layout needs to be defined, then find the other part of the code where all the action listeners are added, etc... Another problem is that the Swing layouts are complex and also an annoyance to hard code... it is difficult to judge what the exact outcome will look like when you have to edit GroupLayouts with other swing components already layed out in them.
Also, I can't edit this in NetBeans because the Generator is very fussy and if I copy+paste code in there it wont read it as a Java Form nor generate an XML file which I think it uses to manage your layout.
Are there any free GUI designers out there that take a bunch of java swing code and allow you to graphically edit it? How do professionals manage their graphical layouts?
So I should have implemented the Model-View approach from the start.
Here is a nice tutorial on the subject:
http://people.csail.mit.edu/phw/OnToJava/ONTOJAVA755.HTML
Has anyone come across a fully customizable (compatible with all standard LnF), fast file browser component for Java Swing ?
I should be able to place this component to Netbeans UI palette and drag and drop in to any JPanel while designing the UI. Also it should support directory, single file, multiple file selection along with file type filtering.
There must be something because I have seen this in applications like jEdit etc.
Note that I am not asking about a dialog box like JFileChooser instead a browser/explorer/tree-view like component.
Here's a relatively simple file system browser built in a JPanel:
File Tree
Here are a few more complex examples of a file browser with icons, popup menus, and tooltips.
These are all built in a JFrame:
File Tree with Icons
File Tree with Popup Menu
File Tree with Tooltips
These examples probably aren't as customizable as you may want, but they're a pretty good
starting point for adding new functionality.
For further reading, Swing, Second Edition (Chapter 17) walks through implementing a JTree component for browsing your file system complete with lazy loading, custom renders, popup menus, and tooltips.
If you'd like to see just the source, you can get it here.
There is also the FileBro that you may want to take a look at. Perhaps you can use it, or at least borrow implementation details.
FileBro
see DJ Project:
http://djproject.sourceforge.net/ns/index.html
I would like to know the best method of breaking up large Java Swing classes. Some of mine are quite large and I would like to begin the process of properly modularizing my code. I saw that I could add my classes to Netbeans' palette but the problem is they are not showing me a graphical representation of what it will look like when I "drop" them into the GUI designer. Some third party jar files support getting added to the palette and they provide a graphical preview of what they'll look like once run.
My question is, I don't know the proper terminology for what this "preview" is called so I'm finding it very difficult to search for. I would like some documentation or a tutorial on how to make my current classes able to be added to the palette and see what it is they will look like in the GUI designer.
Thank you!
To get an icon, you need to provide a BeanInfo for you class.
The easiest way to do this is right click on the class in the Project window and select BeanInfo editor....
You'll want to switch to the designer view to configure which properties are expert/hidden/preferred.
Preferred properties appear in the top most fold (Properties) of the Property window.
Expert properties appear in the second fold (Other Properties).
Hidden do not appear at all.
You can also specify whether properties are bound, constrained, etc. To set icons, choose the topmost node of the tree (BeanInfo) and you'll see properties for the icons.
To make NetBeans treat your component as a container (or not a container):
Switch to Source view
Find the line reading
// Here you can add code for customizing the BeanDescriptor.
Add this line:
beanDescriptor.setValue("isContainer", Boolean.TRUE); // Or FALSE if it's not a container