I'm doing a desktop project using JavaFX and already I have faced a new kind of layout that I have never seen before. Here is an image of the required user interface:
I know the basics about TableView and ScrollPane but as you can see there is kind of a non-square TableView in this case. Which kind of controls and/or containers should I use for making this UI?
To me this looks like a GridPane Layout, not a TableView.
Related
I'm a bit new to Javafx and have only ever done simple projects with it. I'm currently working on a more complex project and I'm stumbled into an issue with ScrollPanes. I'm struggling to find out how to make the ScrollPane resize in height whenever I resize the application. Here is my structure:
The Pane indicated by the orange arrow works fine, I can add constraints as shown here:
However I do not have the constraint options on the ScrollPane or the AnchorPane inside of the ScrollPane, which results in this upon resizing of the application:
If I remove the parent Pane and just put the ScrollPane in it's place, I can add the constraints, however if I did that I would not be able to properly design the application as I have it now. In short, I'm just curious if there's an alternate method I can use or if I'm just using bad practice, in which case any advice is appreciated.
Pane simply resizes the children to the preferred size and keeps the position. This means no resizing is applied. Also it does not offer any further layout constraints.
You could simply replace the parent pane with a AnchorPane and the anchors become available again.
However a AnchorPane(base) containing that many Panes, probably all with different AnchorPane constraints, indicates that the scene should probably be restructured a bit. E.g. a GridPane, VBox, HBox or a combination of those could help you achieve the desired result in a simpler way.
See Using Built-in Layout Panes for a description of the available layouts and example uses.
I am new to java. I was Developing apps in c# in past. I am using NetBeans gui designer. I have created a new JFrame in which layout is set to group layout in which there's scrollpane. I am adding components on runtime by using following code.
MyScrollPane.add(new javax.swing.JButton("Button1");
MyScrollPane.add(new javax.swing.JCheckBox("CheckBox1");
this.revalidate();
The problem is that these components are not showing in scrollpane.
Another problem is that there is no option for absolute layout. Because I want to generate a scrollable list which will get values from database and generate list at runtime.
NetBeans gui designer leverages GroupLayout to facilitate building of UIs. Adding components to this layout manager at runtime involves adding horizontal & vertical sequential groups which can be quite complex. A good reason to start coding using standard layout managers when starting starting out.
You shouldn't be adding anything to a JScrollPane (I assume MyScrollPane is a JScrollPane). Your buttons should be added the JPanel that is the view of the scroll pane.
I need to place few buttons one under another and few textboxes in the same way using SWT.
When I'm doing that, they are next to each other and I cannot change it even using
button1.setLocation(new Point(100,20));
button2.setLocation(new Point(400,10));
Can I add those things to something similiar to SWING's JPanel and move/position it freely as I need? Or maybe another solution? As to let You know - I cannot use SWING here. It has to be SWT. The reason is that I have already a chart made with SWT. The buttons and textboxes should be placed so they won't be covering my chart.
You can dynamically add a new control to the existing layout, but make sure you call the layout() on the parent Composite, where you have set the layout.
If you want to place a SWT control relative to another control, you can use org.eclipse.swt.layout.FormLayout.
I am making a desktop application in Java and confused as to which swing component to use to achieve this result.
Here is the screenshot of the app.
I want to know the component for the content shown in the JScrollPane.
I am thinking of JList or JTable with Providing a Custom Renderer.
There will be alphabet headers and rows containing information.
Each row can be clicked to open a new window.
Row will also change its color on hovering.
there are two ways
JTreeTable (non_free Jide or SwingX)
Accordion (implemented in JavaFX)
You should go with JavaFX Accordion
Titled Pane and Accordion
I had started working on a java based tool that my friend has developed. Now we are working on it together. He has used custom made jpanels and used them in jtabed pane like fashion. Its something like this,(check the link for the screen shot,since i am new user,i cannot post images here)
https://www.dropbox.com/s/5wnrmxiraywlg7p/tab2.png
The problem is that,we want to implement a browser like display of tabs,when the number of tabs opened is more that the panels widths,it gets hided.so the idea is to develop a left and right brows tab buttons tats similar to web broswer .how this could b achieved?
More info about the current layout and design:
The canvas panels are created and tab panels are created and finally called in the main display panel. The stagetab panel holds the tab panels(which mimics appearances of the tabbed pane). Also there already functions to display various canvas panel(different tabs) based on user pressing the tab panels.so all those are working well. have been looking on various solutions for this problem.one sch is developing an custom view port like method similar to jscroll pane which could be used here.
What would be the better way to do this?
A good possibility would be to use SCROLL_TAB_LAYOUT as tabLayoutPolicy. This will show two arrows at the corner of the JTabbedPane. Of course you could redesign the component to show it as you want.
You can find an image of a table using it here.