swing

Best Practice Guide: Swing

Hi! Does anybody know Swing related GUI guidelines - specifically on how to design Swing apps and which components I should use? I'm not looking for an official standard, but pragmatic tips I can use to set a good standard for my projects. I haven't used too much of Swing by myself. Surely clicking a GUI with a GUI designer isn't a big...

java/swing: clipboard paste

I have a DropTargetListener setup to allow me to drag + drop strings into some tables of my Swing application -- on a drop, I parse the string and insert data into the table. I would like to do the same thing with a clipboard paste (Ctrl-V). What literature is there to explain how to handle clipboard pastes? I'm looking at some stuff fr...

How to Stich multiple java.awt.Image objects

Refereing to my previous question, http://stackoverflow.com/questions/2682364/how-to-stich-to-image-objects-in-java I successfully stiched two java.awt.Image objects, now I need to stich multiple objects of the same type. Is there any API or library available for that ...

Putting sql result set into JList

Hi there. I'm working on my second year project and I'm nearly finished, but I've got a problem. I have a table set up in Oracle that holds user names, recipients, and messages. I wanted to make a contacts list for sending messages that would take the user names and put them into a swing jlist but i cant figure out how. I thought m...

Java/Swing: JTable.rowAtPoint doesn't work correctly for points outside the table?

I have this code to get a row from a JTable that is generated by a DragEvent for a DropTarget in some component C which may or may not be the JTable: public int getRowFromDragEvent(DropTargetDragEvent event) { Point p = event.getLocation(); if (event.getSource() != this.table) { SwingUtilities.convert...

JButton Layout Issue

I'm putting together the basic layout for a contacts book, and I want to know how I can make the 3 test buttons span from edge to edge just as the arrow buttons do. private static class ButtonHandler implements ActionListener { public void actionPerformed(ActionEvent e) { System.out.println("Code Placeholder"); } } public sta...

Unable to programatically scroll to last item in JList

I have a JList nested inside of a JScrollPane. When I add items to the JList, I want the JScrollPane to automatically scroll to the bottom of the JList so the last item is visible. To do this, I have the following code: getWordListScroller().getVerticalScrollBar().getModel().setValue(getWordListScroller().getVerticalScrollBar().getMod...

JFrame that has multiple layers

Hello, I have a window that has two layers: a static background and a foreground that contains moving objects. My idea is to draw the background just once (because it's not going to change), so I make the changing panel transparent and add it on top of the static background. Here is the code for this: public static void main(String[] a...

jfreechart time series chart with events

I am using jfreechart (specially ChartFactory.createTimeSeriesChart()). Is there a way to signal events like Google Finance charts, see the A, B, C etc on the right and in the chart. ...

Java Swing - JCheckbox with 3 states (full selected, partially selected and deselected)

I want a JCheckbox that has 3 states as shown below: Partially Selected Unselected Full Selected Q1. Can I use the JCheckbox for the above purpose or have to go for some custom swing component? ...

Java Swing popup visibility

Why a popup created like this is shown in front of all windows applications with JRE 1.6.0_18 but it doesn't using 1.6.0_03 ? PopupFactory popupFactory = new PopupFactory(); Popup popup= popupFactory.getPopup(null,new JPanel(),200,200); popup.show(); ...

Adding a JLabel to JLayeredPane from event listener not dragging.

Ok, So for some reason When I add components to a JLayeredPane in its constructor: JLabel label = new JLabel(); label.setSize(100,100); label.setText("This works"); add(label); It works perfectly fine, but If a add it later in the JLayeredPane's parent EDT it doesnt let me move the objects around but they let me see the objec...

How I can get output from 1st frame textfield input text to 2nd frame textArea

Here is my 1st frame - I want went I input text in textfield example name then click button report will display output to 2nd frame using textArea... please help me import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.border.*; public class Order extends JFrame implements ActionListener { private J...

java Swing Listeners: components listening at each others.

Hi all, I want to code two JList (categories and items). When I click one category it should select all the items for that category and when I click on one item it should select its categories. So both JList will have a ListSelectionListener listening at each other and changing the selection. Should I fear about some a of "loop" ? Is th...

Reinstantiating a GUI (JFrame) object

Hi guys, basically I want my JFrame to become a completely new JFrame object when an event is triggered. I have some code that basically calls [CODE]GUI gui = new GUI(x, y)[/CODE] the only problem I'm having is that as well as creating the new GUI object, it is not deleting the old window. Can anyone tell me how to get rid of the old win...

JMenu issue with Gnome's native look and feel.

I stumbled on a very odd problem while trying to set up a JMenuBar with the native look and feel of Gnome. Here is a screenshot: http://img23.imageshack.us/i/issuel.png/ It has to say File there but it gets cut out. http://pastebin.com/CjFhmxcf http://pastebin.com/gwB3vnC3 Any, help is appreciated! ...

Background image in java

hi, i'm trying to put an image as a background of my interface in java , i tried to write a class that does that and using it , but is there a simpler way to do that . here 's the code i used: import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import javax.swing....

When should I write my own Look and Feel for Java Swing instead of customizing one?

I have used a few different Look and Feels for Java Swing, but I don't really like anyone to 100% so I often end up with customizing it a lot. Sometimes I am thinking about if it is a better idea to write my own LaF (by extending an existing one), but I don't really know. For the moment, I mostly use Nimbus, but I change all colors (to ...

Swingworker producing duplicate output/output out of order?

What is the proper way to guarantee delivery when using a SwingWorker? I'm trying to route data from an InputStream to a JTextArea, and I'm running my SwingWorker with the execute method. I think I'm following the example here, but I'm getting out of order results, duplicates, and general nonsense. Here is my non-working SwingWorker: c...

JCombobox containing enum values inside a table

Hello, I have a class containing Enum with values. (names) In other class I would like to enter inside a table a cell type of JCombobox that will use these enums values. my problem is to combain between string values and the enum. for example the enum class: enum item_Type {entree, main_Meal, Dessert, Drink} for example th...