swing

Java swing UI crash debugging

I am trying to debug a problem where a user clicks on the button and the UI just dies. I know, good luck. The logs just end after the user clicks the button so i'm thinking there may be some exception/error that we are not logging. Maybe an OutOfMemoryError. Any suggestions on how to proceed? to get more information. Java command ...

Getting ENTER to work with a JSpinner the way it does with a JTextField

First, to make my job explaining a bit easier, here's some of my code: JSpinner spin = new JSpinner( ); JFormattedTextField text = getTextField( spin ); text.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed( java.awt.event.ActionEvent evt ) { // Do stuff... } ...

How to focus on JTextField within a table.

I'm writing a search & replace function in a kind of spreadsheet program. What I want is that if you search for a string, the program shows a table with the element that has been found. So far so good, but I cannot get the element to obtain the focus, with the cursor in it so you can immediately start typing. I'm using a customized JTa...

In Java Swing how do you get a Win32 window handle (hwnd) reference to a window?

In Java 1.4 you could use ((SunToolkit) Toolkit.getDefaultToolkit()).getNativeWindowHandleFromComponent() but that was removed. It looks like you have to use JNI to do this now. Do you have the JNI code and sample Java code to do this? I need this to call the Win32 GetWindowLong and SetWindowLong API calls, which can be done via the Ja...

Automatically size JPanel inside JFrame

I have a JPanel subclass on which I add buutons, labels, tables, etc. To show on screen it I use JFrame: MainPanel mainPanel = new MainPanel(); //JPanel subclass JFrame mainFrame = new JFrame(); mainFrame.setTitle("main window title"); mainFrame.getContentPane().add(mainPanel); mainFrame.setLocation(100, 100); mainFrame.pack(); mainFra...

Changing the Contents of the JComboBox

I would like to change the contents of the list of a JComboBox (like adding another list in place of and older one). Is there any way I might be able to do that? Thanks in advance! ...

How to design interface for a game in Java

We're a team of a designer and a programmer. Me, the programmer, is hopeless on design of all sorts, so the user interface of the game must be created by the designer. We were thinking of a main screen, where the character walks around, a small minimap in the top, an inventory section, etc. All these things would have to be designed in ...

How do I get my netbeans drag and drop widget to know whether it is rendering inside the netbeans design view window or the running application?

How do I get my netbeans drag and drop widget to know whether it is rendering inside the netbeans design view window or the running application? I'm trying to do some custom rendering. I think it has to do with the root container. ...

Changing JTable reference at runtime - not appearing in GUI

Hi there, I'm trying to get to grips with Java ME development for the Pocket PC. I'm running the NSIcom CrE-ME emulator and building my application with NetBeans 6.5. The application is based around three tab panels, each of which have Swing components. The contents Swing components are updated at various points in the application. The...

How can I get the length of a JTextField's contents as the user types?

JTextField has a keyTyped event but it seems that at the time it fires the contents of the cell have not yet changed. Because of that .length() is always wrong if read here. There must be a simple way of getting the length as it appears to the user after a key stroke? ...

Add New Column in Infragistics Wingrid

I am using Infragistics wingrid in my application. I have assigned a datasource to my wingrid.Now i want to add a new column at a specific location. Can any one plz tell me how can this be performed. Regards, Savan ...

Where are Swing applications used?

Are Swing applications really used nowadays? I don't find a place where they are used. Is it okay to skip the AWT and Swing package (I learned a bit of the basics though)? ...

Is Google Web Toolkit similar to AWT and Swing

I've looked breifly into GWT and like the idea that I can develop in Java and have the application compile down to HTML and JavaScript. Is the concept behind GWT and AWT and Swing the same or different? ...

What is the difference between swing and awt?

Can some one please explain me what is the difference between swing and awt? Are there any cases where awt is more useful/ advised to use then swing or vice-versa? Thanks in advance. ...

Java(Swing): influence height of JList in GridBagLayout

I want to build a dialog in Java with a List and a couple of buttons underneath it. The list ends up with the same height as the buttons (about one line) and the whole dialog is about two lines of height. However, I'd like the dialog to be taller (maybe 10 lines) and the JList to take up most of the space .. I've played around with the ...

JDialog not painting

I'm new to java but I would have thought this was pretty straight foward. I display a JDialog for user input when importing data from a text file but the dialog isn't being painted properly on other computers. On my computer if I run the program from within NetBeans or from the command prompt then the dialog displays properly. If I run ...

Override JComponent.getBaselineResizeBehavior() but keep Java5 compatibility

For my Swing project, I need to support both Java 5 and Java 6. I have defined a custom JComponent (call it Picture) and, after embedding it in a JScrollPane, I put it in a JPanel that uses DesignGridLayout manager. DesignGridLayout supports baseline alignment thanks to swing-layout open source library (implements baseline support for ...

Swing Large Files Performance

Hello, We need to load and display large files (rich text) using swing, about 50mb. The problem is that the performance to render the files is incredibly poor. We tried both JTextPane and JEditorPane with no luck. Does someone have experience with this and could give me some advise ? thanks, ...

ExecutorService vs Swing Timer

I've been reading Filthy Rich Clients lately and noticed that, although the version of Java is 6, there is no mention of the Concurrent Framework. So, they talk about java.util.Timer and javax.swing.Timer but not about the ExecutorService. I read about the advantages of ExecutorService in the question "Java Timer vs ExecutorService" and...

swing components are light-weight ?

Whenever i read about swing they say they are light weight components.so i just googled swing and found that it means swing does not depend on native peers.Is that why they are called "light weight" ? I mean by light weight i thought maybe the swing components occupy less memory than the awt components.isnt that so ? ...