I realize that if you are having a same selection in JComboBox, using up/down arrow key, will not help you to navigate the selection around. How I can avoid this behavior?
See the screenshot below:
public class NewJFrame extends javax.swing.JFrame {
/** Creates new form NewJFrame */
public NewJFrame() {
initComponen...
How would I link the file choosen from a JFileChooser to a file and how would I convert it to string being able to display and edit it in a TextArea?
I have the GUI set up using swing, but the link between actionListener and the JFileChooser is not complete.
Any help would be much appreciated.
Code: http://pastebin.com/p3fb17Wi
EDIT:...
Hello,
I want to set the size of a JFrame such that the contentPane is the desired size. JFrame.setSize() doesn't take the window decorations into account, so the contentPane is slightly too small. The size of the window decorations are platform and theme specific, so it's bad news to try to manually account for them.
JFrame.getConte...
I'm creating a game in Java for fun and I'm trying to decide how to organize my classes for the GUI. So far, all the classes with only the swing components and layout (no logic) are in a package called "ui". I now need to add listeners (i.e. ActionListener) to components (i.e. button). The listeners need to communicate with the Game clas...
Let's say I would like to create a simple calculator. It consists of 3 fields. Text field to show result, field with checkboxes to select system and field with numbers.
What kind of component should I use for each element ?
How can I position elements in my window ?
How can I position elements inside component (ie checkboxes) ?
This is...
Our team is now working on a big Swing application. Our job basically focuses on writing extensions to the existing framework. A typical job would be adding a new panel/ or adding a new tab with some extra functionalities that suit our need.
It seems FEST can help a lot in terms of unit-test our code. I am going to try it out this week...
I'm trying to get image built from tiled set of images So to JPanel I'm adding JButtons with ImageIcons. All images are in folder with my classes (NetBeans), and they're named u1, u2, ..., u16. But on button there is no image shown. What am I doing wrong ?
JPanel panel = new JPanel(new GridLayout(4, 4, 3, 3));
for (int i = 1; i <...
How can I draw simplest eyes in Java's swing ? I would like to get something like that :
http://img710.imageshack.us/img710/70/eyesp.jpg
...
I am having some pretty strange symptoms with JPanels and CardLayout. Essentially, I have cards which act as "pages" since I can only hold 12 cells on the grid, and I display each page as a card, and clicking -> and <- buttons change pages accordingly (or that's the idea). Because this data is representing a changing model, every five se...
I am creating my java Swing application in Netbeans. At present there are more than 2000 lines of code. Is it right to have these many number of lines in a single file. Moreover the IDE has become slow when i am editing this file. Is there any way to overcome this?
...
I'd like to be able to freeze columns in JXTable just like in Excel spreadsheet and came across this project: xframe-swing's JXTable.
Just wondering if there is a tutorial for this project. Note that this is not the same as JXTable in swingx project.
Or perhaps there is another way?
...
For a scientific application I want to design an input form which lets the user enter certain parameters. Some of them are designated using greek letters, some of them have latin letters. The parameter names should be displayed using ordinary JLabel controls.
On Windows, the Tahoma font (which is used for Labels by default) contains bot...
I want to maintain the tab index. [ which we have in .NET ].
But i want this is on my Java application.
So is their properties or method to do that?
...
Hello,
I am creating a chat application using JApplet. I created socket in init() method and everything seems to work fine. Now i want to send message "user has left the room" when he closes the window (in which JApplet resides) as well as also close the sockets.
I wrote my cleanup tasks in destroy() method. But they don't seem to work....
Hi,
I am stuck with a problem in Netbeans. I created JPanel component and created an action in it. Now when I use this component in parent frame, I want to create a frame toolbar, that calls the component action. How can I do that?
...
Hi,
I'm a Java developer wich is just starting to learn .net. When coding my user interfaces with Java we can count with the TableModel interface wich makes the process of representing objects in data tables something really easy.
In .net what is the equivalent? I don´t want to show data which is stored on databases, but the tabular re...
I have data from a database loaded into a JTable through a custom table model. I want to have a column (should be the first column) which simply shows the display row number (i.e. it is not tied to any data (or sorting) but is simply the row number on the screen starting at 1). These "row headers" should be grayed out like the row head...
I am looking for a component I can use in Swing that acts as a GUI console which
has a text area with scrollbars that can be set to a particular font
has an InputStream and an OutputStream that a host application can obtain
accepts keyboard input, prints it onto the end of the console text, and sends that input to the InputStream
prin...
I want my panel to fit the frame when I show/hide fields. How could I notify to the parent frame to revalidate?
I thought about pass the frame to my panel's constructor, but I think may have a way this is already done. I remember that there was a protected attribute in JPanel, but there isn't.. maybe i remembering the wrong component.
...
I want to create a table which displays in each row a set of data, in addition to a radio button for possible selection.
This can be achieved easily by using a simple table model class which extends the DefaultTableModel and a cell renderer and editor class which implements the TableCellRenderer and TableCellEditor interfaces respective...