Populating Swing JComboBox from Enum
I would like to populate a java.swing JComboBox with values from an Enum. e.g. public enum Mood { HAPPY, SAD, AWESOME; } and have these three values populate a readonly JComboBox. Thanks! ...
I would like to populate a java.swing JComboBox with values from an Enum. e.g. public enum Mood { HAPPY, SAD, AWESOME; } and have these three values populate a readonly JComboBox. Thanks! ...
My custom component is composed of three JTrees inside a JPanel. Only one JTree should be selected at a time, so I've added a TreeSelectionListener to each of them that calls clearSelection on the previously selected JTree. I'd like to add other TreeSelectionListeners to the JTrees being sure that the selection- handling listeners alway...
I have a JPanel and when its layout changes, I need to re-layout the parent. This can easily be done with panel.getParent().validate(), but the problem is, I don't always know if its direct parent, or maybe some parent somewhere in the tree is really the one that needs to be validated. Is there a way for a parent component to listen to s...
Hai I am developing a standalone application using Java in which I am using a JTable.The problem is when I enter a multiline text,the entire text is not displayed in the cell while I am typing.I get a scroll when I type a multiline text.How can I get my whole text to be visible while I type.i.e How can I increase my Cell width in JTable ...
How do you make a "property list" component in Swing? I mean the kind as in this or this image. Is it just a customized JTable component, or a custom component altogether? ...
Hai I am developing a standalone application using Java in which I am using a JTable.The problem is when I enter a multiline text,the entire text is not displayed in the cell while I am typing.I get a scroll when I type a multiline text.How can I get my whole text to be visible while I type.i.e How can I increase my Cell width in JTable...
In my Swing application I have the problem that when creating a new instance of a Swing form for the first time, it takes several hundreds of milliseconds. That's not really long but the subjective impression of getting slowed down is really annoying. It happens with all forms, even a JOptionPane message or other trivial forms. (Of cou...
My custom component is composed of three JTrees inside a JPanel. Only one JTree should be selected at a time, so I've added a TreeSelectionListener to each of them that calls clearSelection() on the previously selected JTree. (See here for more details). That works fine, but I need to prevent the TreeSelectionListeners to trigger when ...
Hello, I have created one GUI using Swing of Java. I have to now set one sample.jpeg image as a background to the frame on which I have put my components.How to do that ? ...
I'm using a JSlider to show progress in my application, so that it updates as a certain process computes. I want a user to be able to drag the thumb backwards to a tick mark in the past, but when this happens, I want the progress indicator to remain at its current position. // A dismal attempt at drawing the situation Progress: ------...
How can I get JTextFields to allow Ctrl-Delete and Ctrl-Backspace when editing text? In various other programs, these key combinations can delete an entire word in one go. From what I can tell, the default behaviour of a JTextField allows the user to use CTRL to jump over an entire word when using left and right keys, and to select an ...
Hi everyone, I am currently working on a drag n drop application and I would really like to know what's happening inside the JLayeredPane and I get a particular program behaviour... Here's the deal: I have a chessboard placed on the DEFAULT_LAYER. I also have a chessPiece which I'd like to be added to the DRAG_LAYER when I move it. B...
Hi everyone, I'm having some trouble designing an MDI Application with Swing. I have no trouble implementing the JDesktopPane & JInternalFrames, my question will be a little more specific. Here is my base container Frame in a glance: package applicationGUI; import javax.swing.JFrame; public class DesktopContainer extends JFrame{ /* F...
Hi I have a little app that at the moment consists of a JPanel with an "Open File" button. Once the user clicks the button a new JFileChooser is created so the user can select a file. Once the user selected a file, this file will be processed. What I want to do, is to set the text on the JPanel to "Processing File" While the file is be...
I have a custom textfield class that extends the JTextField class in Swing. I need to find a way to disable the default actions for Ctrl-A (select all), Ctrl-H (backspace) etc, so that the window containing the textfield can map these shortcuts to whatever it wants. Any help would be greatly appreciated. ...
My apps pops up a dialog. Users usually want to switch back and forth between this dialog and the application window for a period of time. I want this dialog to stay on top, so that it doesn't get hidden behind the main application window. But at the same time I want the dialog to have a minimize button so that it can get out of the way ...
I am writing a TotalCommander-like application. I have a separate component for file list, and a model for it. Model support listeners and issues a notification for events like CurrentDirChanged etc. in following manner: private void fireCurrentDirectoryChanged(final IFile dir) { if (SwingUtilities.isEventDispatchThread()) for...
Hello, I have created one GUI in Swing Java in which I have used JTable.Now I want to display next page information into it by using pagination. How should I do that ? ...
Hello, I have created one GUI in which I have used a JFrame. How should I make it Modal? ...
Hi I have created a slider in java in linux platform. But the slider gave different look and feel in different operating systems. Means in linux it looks little bit good but in mac operating system the slider looks different. so how to give same look and feel to my slider irrespective of operating system The code is given below. import...