Which Swing component for this design? - java

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

Related

Need suggestions for making a layout containing TableView and ScrollPane

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.

Add Contents Dynamically to java swing jpanel

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.

Trying to recreate Skype conversation panel with Swing

I am trying to recreate the Skype handles instant messaging using Swing components. I am using JList with a custom ListCellRenderer to render each cell in the list. The ListCellRenderer extends a JPanel, the JPanel simply contains a label (where I will put the username) and a JTextArea which is where the users' messages will go. The JTextArea is what Im having problems with.
Here's an image of what I have a the moment -
Ive removed the scrollpane that automatically comes with the textarea in netbeans.
I am showing the Navigator, the Design view and the actual program (the list has two elements) in this image.
The the text in textarea is actually much longer than in this image but it is not word wrapping. I have set lineWrap and wrapStyleWord to true in the properties box for this textarea but it doesn't seem to take any effect. I then tried to set maximum size using the properties box and that doesn't have any effect either.
Is there any way to control the padding/margins around components with netbeans gui designer. The automatic placement it gives me for spacing between components is either several pixels too small or two large. I need exact placement on the list's cell components.
For reference here is how skype's convesation panel looks (ive added in the red "Brian cs"'s as thats how I will be doing it in my program). As you can see the sentences wrap and there is an appropriate amount of space between cells. So anyone know how to achieve this using Swing?
The JTextarea is not the problem. The JList sets the heigth for each row. See JList.setFixedCellHeigth or setPrototypeCellValue

Mixing JavaFX and Swing

i am writing a desktop application and i like to use swing components since javafx doen't provide a tabbedpane component. I can embed my custom swing component with SwingComponent.wrap(swingComp); So i have a swing tabbedpane which accepts swing components as child items. These child items are swing components too and they have two properties, title and content. Title is a string but content is a swingcomponent. How can i embed a javafx container again in those swing tabs? Thanks in advance.
I suspect that once you go from JavaFX to Swing using the wrap method, you can't return to JavaFX.
You probably need to specify a JPanel, then add the JTabbedPane to the JPanel. Your content would reference the JPanel.

What is this component name

What is the name of the component in java Swing shown in the following link
http://www.scriptocean.com/template3.html
It is known as extended ListView in Android. But I want to know the same in Java Swing.
Do you mean this component ?
If so, to display it in Java, you have some choices.
If you want your items to be easily clickable (that's to say action senders), you would tend to use JButtons in a vertical BoxLayout 'ed JPanel
If you simply want to display items, then customize their display, you would undoubtly go the JList way. Also take a look at Swing tutorial, which is always of great help.
EDIT
Accordint o comment, to have an area below the button displaying content, you'll use the second solution with a twist. As all elements in Swing are in fact JComponents and can be put in thers, you'll use JPanel as JList elements. in each JPanel, you'll have ione button always visible and one sub-panel that is hidden at startup. When clicking the JButton, you'll simply show or hide the associated sub-panel. If you want to have some kind of effect, you can either
wait for the upcoming JavaFX transitions effects
Use Filthy Rcih Clients animations library (take a look at their links page).
There is no standard Swing component that behaves like in your example. But you can find something similar in the SwingX project : the JXTaskPane and JXTaskPaneContainer components.
Unlike your example, the sections are not exclusive. But you can achieve this exclusivity with a few lines of code.

Categories