swing

JTable adjusting column width or height

In my JTable is there a way to restrict the user in adjusting the height of the row or width of a column using the mouse.I am already using JTable table=new JTable(); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); table.getTableHeader().setReorderingAllowed(false); The table is inside a scroll panel. ...

Can I set the selected item for a JList without having an event thrown to the listeners?

I am working on a viewer, which uses a JList to show thumbnails of the pages of a document. The user can open a page by selecting it through in the JList, or throught other mechanisms, like entering the number in a text box. When using the latter alternative, I want that the JList also selects the page. I do this using setSelectedIndex(...

Gracefully shutting down a Java OpenGL (JOGL) app

I have an application with a JOGL component. When it shuts down using System.exit(0), I frequently get the exception: java.lang.InterruptedException at java.lang.Object.wait(Native Method) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:118) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:134) at sun.java2d.Dispose...

accessing member methods of helper class from main class (netbeans`s swing editor)

I have just started with Gui Programming in netbeans (Using the template Java Desktop Application). However I am already stuck. In my main class I have some methods which can be called from the Gui. These methods do something on an external file and in case of an error they should open up a new window, displaying an error massage. Howev...

How to set JPanel size?

I'm using Netbean's form creator and I'm trying out some things. I'm not sure if it's the layout manager, but when I create my own JPanel and add it to the main content pane of the my window, the size of the panel always maximizes inside the FrameView no matter what re-dimensioning methodology I use such as setSize or setPreferred size. ...

OfficeBean won't display after moving containing Swing Panel from one Container to another

Hi, I'm developing a Java 6 applet which allows users to view OO (v.3.2) documents (read only), and if they choose, click a button which launches a new JDialog window, with the document displayed in it which allows the user to and mark and redact it as they wish. Once they are done, they can close the JDialog, which saves the document t...

Java swing application save custom file format

Hello, i'am writing some swing applications(not rich clients, running standalone) with a lot of domain models. Those are Java Beans, bound to the UI via presentation models. Now i need to save all the domain data in some kind of a custom project file format. The software will go through many versions, in wich the domain models always ...

How can I run all methods of a class on Event Dispatch Thread

I've created a Swing component which has several methods. Now I want all methods of this class be run on Event Dispatch Thread (EDT), while callers are on Worker threads. The only solution currently in my mind is this: for each method public void a(params) on this class, I should rename it to private void aOnEDT(params) and ...

Scroll through JLabel held in JScrollPane

I have a JScrollPane that holds a JLabel using the following code: //Create TEXT LOG JPanel textLogPane = new JScrollPane(logLabel); textLogPane.setPreferredSize(textLogPaneDim); //textLogPane.setOpaque(true); textLogPane.setBorder(BorderFactory.createLineBorder(Color.BLACK)); textLogPane.getViewp...

Keeping GUI Development skills sharp

I've been developing in Java Swing for a while now, and I'm starting to feel that Swing-based desktop applications are feeling a little stale and are tedious to develop. I'm seeing new applications that look very sleek and modern, like TweetDeck and Synthesia (a piano game). Despite the wisdom in Haase & Guy's "Filthy Rich Clients," I ...

Java: Can i print a JFrame/JPanel as it looks on screen?

Hi If i design a JFrame/JPanel with labels, tables, textfields etc, is it possible to print it as it looks on screen? If so, what size parameters should i keep in mind? Considering it's an A4 page, how should i go about sizing my JFrame/JPanel? Thank you. : ) ...

Is Java Swing out of date ?

HI all I downloaded Net Beans IDE and created a new desktop aplication. I choose it to be Swing app. The IDE displayed that the Swing framework is out of date and will not be supported in the future. does this mean that Swing is out of date ? and if so what are the most recent frameworks that can be used to develop desktop applications...

Java swing how to do when mouse over pop out a small box to show details.

I have a JTable displays the event accordingly, I want to do like when mouse over the table cell will pop out a small box show the event details. Something like tooltip how can i do that? is there any component in swing doing that? ...

Non ASCII characters not being shown up

Hi, I have a little strange problem. I am working on a java web start application(using swing) which paints a particular image on the (canvas)JPanel. Some of the placeholders on it have some non ASCII characters as their text. Now when that image is being painted on the canvas, the canvas shows '[]' as if it is unable to recognize...

Adding a contribution to the windows task bar in java - similar to laptop battery widgets!

Hey guys, I am trying to make a contribution to the windows task bar so when i minimize my app it docks itself into the windows task bar , the best way of describing this is by looking at a picture I have drawn: If anybody knows if this is possible or how to do it please let me know. I am well aware of the ability to add an icon to ...

How do I redispatch ANY AWTEvent in java?

Hi, I have a feature to implement in a Java 1.5 Swing based application. If a particular exception happens when processing an AWTEvent, I have to popup an alternate form, resolve the problem and continue processing the original event. When I redispatch the event to the component nothing happens. When I push the event into the event que...

Releasing code containing Java Swing, what license?

I'm getting to close to project completion, and I would like to make my code open source, releasing it under GPLv2 or Apache, something of that ilk. However, I had read somewhere that there is no free implementation of Java Swing, and so code depending on swing couldn't be released under those licenses. Is this true? And if so, what lice...

How to set line spacing/height in a JLabel in Java Swing?

I have the following JLabel code: JLabel someJLabel = new JLabel("<html>first line<br>second line</html>"); someJLabel.setFont(new Font("Arial", Font.PLAIN, 16)); What I'd like to do is be able to control the line height/spacing between the two lines. PS: I've also looked at using paragraphs instead of breaklines, but it's the same ...

How to close a JFrame based window with a JButton click event

I am new to the whole Java Swing/AWT dialogs (which explains how amateurish this dialog below looks like, any help in arranging it better is welcome :) and I am struggling to close this popUp window when any of the two JButtons are clicked. I have already tried options like frame.dispose(), frame.setVisible(false) and even SwingUtilitie...

java swing program not closing after dispose is called on last window

Preface: This is the first real swing program I have done. I have a swing program, where one JButton is supposed to exit the program. That button triggers this.dispose();. When i click this JButton, it does make the window completely go away, but looking at the debugger, the program itself is still running. My main method only consists...