swing

Excel spreadsheet like library in Swing (=improved JTable)

Hello, I'm searching for a free, open-source if possible, Java swing library that improves the existent JTable (which is very simple). I want to do an application with a spreadsheet similar to Excel one. Without the formula but with copy/paste functionalities (multiple paste if multiple selection), column reorganizing, etc... I've fou...

Problems editing a JCheckBox node in a JTree

I am attempting to modify the standard Swing JTree to intermingle nodes with and without checkboxes. This is an example: When I attempt to check/uncheck one of the checkboxes (the 'User 01' node in this example), the tree loses nodes: I my code is an adaptation of this example: http://forums.sun.com/thread.jspa?threadID=5321084&am...

Swing Application Framework @Action annotation ? what for ?

I'm actually using the Swing Application Framework on a desktop application and make good use of the session state persistence and resource manager (great for globalization) Now I have been testing the @Action annotation feature, and really I don't see any advantage over NOT using it. The official doc lists mainly these advantages: ...

Redefine the behavior of the Tab key in a JRadioButton?

I'm trying to redefine the behavior of the Tab key in a JRadioButton so it behaves like radio buttons in other GUI applications, that is: Arrow keys cycle through the radio buttons in the ButtonGroup (I have this working) Tab moves focus to the next component after the last radio button in the group (Problem area) I have an Action th...

how to use JRadioButton groups with a model

Is there any way to associate a group of JRadioButtons with a data model so it is easier to tell which button (if any) is selected? In an ideal world, I would like to associate a group of N radiobuttons with an enum class that has a NONE value and one value associated with each radiobutton. ...

How to add a JComboBox to a JTable cell?

I am trying to add JComponents to JTable Cells. Do I Implement CellRenderer or CellEditor? ...

JPA cascade update problem. Am i doing this the wrong way?

Hi everyone, i'm using JPA on a SWING application in JAVA that connects to an Apache DERBY embedded database. I use Netbeans as my IDE and use many of the "suposedly" helpfull templates. My problem it's simple, but it's dificult for me to explain so i will paste the relevant code here and try to explain at the bottom. @Entity public c...

Swing on OSX: How to Trap command-Q?

After being convinced ("schooled") that Swing apps on Mac do look native, I'm trying to make mine look as native as possible. Everything looks great, but when I hit command-Q or do it from the menu, my windowStateChanged(WindowEvent e) is not firing on my main JFrame (if I exit in any other way, it does fire). How can I respond to the re...

Whats the proper event for changes in any cell of JTable?

I have a simple JTable, there are two columns that matter: quantity and value (Integers). Each time user enters a new row or updates one, each rows value must be multiplied by quantity, results sumed together and the result sum displayed in a JLabel outside the JTable. Looks pretty simple. Except that I have no idea what event should I l...

Java Panel Double Buffering

Hey everyone, wondered if anyone could point me in the right directon, i have developed a pong game and it needs double buffering due to flickering. Iv tryed some of the post on here to try and make it work, but im still a beginner with the swing awt suff, any help would be amazing thanks. public class PongPanel extends JPanel implemen...

I dont know how to make dropdown in java

Hi. (using netbeans and java) I have the following 1 text field named input 1 (named x5) 1 text field named input 2 (named plus10) 1 text field named input 3 (named plus5perc) 1 answer field (an uneditable text field) 1 button When a number is placed into either input a calculation is done when the calculate button is pressed e.g. ...

How to build a mix of JTree and JTable?

I would like to have a JTree which also displays some extra information right adjusted, just like there was an extra column, see picture below. Any hints for accomplishing something like this or similar are welcome! ...

TableModel column differentiating between number types

I have a JTable used to store numbers. I really only use the table for viewing/sorting. Is there a downfall (other than maybe needed to allocate more space) to giving the columns a class of Double even if some of the columns may have all ints or longs. I can parse the numbers to see if a column contains all of a single type, but that see...

Convert a region of a JPanel into a BufferedImage

Hi, I need to convert a certain region of an jpanel into a bufferedImage, or other format to be shown in another jpanel. By now, I only saw codes that converts the whole jpanel into a bufferedImage, but in my case, I need just an area inside an jpanel. thanks ...

JFrame not being made at right dimensions

This code, when run, will make a window but not at the specified dimensions. What is wrong with it? import javax.swing.*; import java.awt.*; public class Windowing { void JFrame(){ JFrame frames = new JFrame("Total recall"); frames.setSize(1000,8000); frames.setVisible(true); frames.pack(); /...

Adding Buttons inside cell of JTable along with data?

Hi, Is it possible to add buttons inside the JTable cell along with data? What I am trying to do is to create a table with columns which display data(number) from the database, and two buttons to increase/decrease the number inside the same cell. |ID | Quantity| |06| 2 [+][-] | it would be something like above with [+][-] being but...

borders in java

Hi I want to set single title border to group of textfields how can i do this in java / swing. i have tried below code but text fields are compressing inside panel // Create panel and add some components to it. JPanel pnl = new JPanel(new FlowLayout(FlowLayout.LEFT)); pnl.add(new JLabel("Name")); pnl.add(new JTextField()); // Add ti...

Using vertical splitter in Java Swing GUI?

I am developing a java desktop application. I have some doubts or problems in designing one thing which is as follows: I want to break the the main frame JFrame mainFrame = new JFrame("Demo"); into two parts (divided vertically) so that user can change their size by dragging the common boundary of both the parts to either left or rig...

How to get correct selection in a JTreeTable?

I am working with a JTreeTable as described in an old article at: Sun Developer Network Here are the same files but slightly adjusted for java 6: http://edtaylor80.angelfire.com If you run this little example program you will find that selection works as expected to start with, entire rows are selected when you click a random cell. Thi...

Form.java extends JFrame

I'm a starter at Java. I'd like to create a Form class that extends JFrame to use. Everything works ok, it sizes and centers well on the screen. I just can't add components to it. What am I missing. Googled every class up, couldn't find anything. Main.java: package pongLib; import pongUI.*; public class Main { public static void...