swing

Hide certain actions from Swing's undo manager

I am trying to write a JTextPane which supports some sort of coloring: as the user is typing the text, I am running some code that colors the text according to a certain algorithm. This works well. The problem is that the coloring operations is registered with the undo manager (a DefaultDocumentEvent with EventType.CHANGE). So when the ...

Is there a simple way to remove a TimeSeries from a displayed JFreeChart Chart?

I have a Swing application which uses JFreeChart to display one of a series of queries. Some of these queries have a composite TimeSeries key. Each component of this key can contain a few values, but when rendered makes a very noisy graph. I would like a simple way for the users to hide/show some of the TimeSeries in the displayed Chart ...

Swing buttons don't react immediately! How can I change that?

Hey guys! I've built a form with Netbeans's visual editor. When I press one of the buttons it should do the following : set it to disabled perform a task that takes some time when the task finishes the button will be enabled again However, the following happens: the button remains in a pressed state until the task finishes when th...

Java Swing or Java Qt?

Can someone with extensive experience with both Qt and Java Swing please discuss whether you would use Swing or Qt under Java, and why? Secondly, what is the business impact of using Qt? Is it reasonably popular or will I have a hard time finding experienced Qt developers? Are there any other business impacts I should be aware of? UPDA...

how to control focus in JTable

What I want to do is when user finish editing of data in table cell to move focus onto another cell depending of what user entered, and to turn that cell into editing mode so user can start typing immediately with no additional action. This way user can focus on his work and software will do the 'thinking' about which cell should be edit...

Java rounded Swing JButton

Hi everyone, Well, I have an image that I would like to put as a background to a button (or something clicable). The problem is that this image is round, so I needed to show this image, without any borders and etc. The JComponent that holds this button have a custom background, so the button really need to only show the image. After s...

How do I paint Swing Components to a PDF file with iText?

I would like to print my Swing JComponent via iText to pdf. JComponent com = new JPanel(); com.add( new JLabel("hello") ); PdfWriter writer = PdfWriter.getInstance( document, new FileOutputStream( dFile ) ); document.open( ); PdfContentByte cb = writer.getDirectContent( ); PdfTemplate tp = cb.createTemplate( pageImageableWidth, pageI...

How can I best lay out these components in Swing?

Hi All, What would be the best approach / LayoutManager for a JPanel that needed to display the components shown in the image? (Note that the fields should resize horizontally when the size of the window is changed, but not the labels). I'm currently trying (and struggling) to do it with a GridBagLayout. Is this the correct approach o...

Alternative document structure in JTextPane?

In a JTextPane with a DefaultStyledDocument the document structure (hierarchy of Element objects) ends with a LeafElement that spans all the character of the enclosing paragraph. Is there a way to customize the document such that each leaf element will represent a single character? (Background: I am trying to implementing a custom color...

Swing components inside HTML

Does anybody know of a pure java (ar at least cross platform) open source component/library which displays HTML which can contain swing components inside it? All I could find were either abandoned or incomplete. I am asking because I'm thinking about trying out approach to do use this combination for creating desktop application. EDIT...

"Group Box" in Java Swing

Trying to build a GUI application in Java/Swing. I'm mainly used to "painting" GUIs on the Windows side with tools like VB (or to be more precise Gupta SQLWindows .. wonder how many people know what that is ;-)). I can't find an equivalent of a Group Box in Swing .. With a goup box, you have a square box (usually with a title) around...

VisualEditor in Java - dynamically build sub-panel?

I'm using the "Visual Editor" to "paint" my Swing GUI. Can I dynamically build the contents of a sub-panel with VE or do I have to use a predefined sub-class of JPanel (and build that with VE)? ...

Java: How do you style Swing components?

Hello, I'm writing my first Java project. I was wondering if it's possible to style the Swing components (set a background color, remove the borders from the buttons, etc.) ...

OS recommendation to run Java Swing App on very basic hardware

We have a Client/Server POS application. For the Java Swing Client, we are evaluating a system with very basic hardware Celeron 300 CPU expandable to PIII 1.2 Ghz. 810 E motherboard. 64 MB SD RAM, DIMM's, expandable to 256 MB. 4.3 GB HDD expandable to 80 GB and above. 10 / 100, ethernet / lan card for connecting to server, broadband -...

How can jFrames be used inside of JavaFX?

I just saw a article on swing being used in JavaFX. How can an application that uses a jFrame to display graphics be ported into JavaFX? Also, will the jButtons and jSliders work in the normal manner? I know this is a generic question but I know little of JavaFX and am curious about porting some desktop applications to the web via th...

Swing On-Screen Keyboard

Hi, I am working on a KIOSK System in Java on Windows XP. And need to do a on screen key board. I have no idea about it that how to do. So can you guys please help me out to do this. Any one have some idea about it. Thanks ...

Can a Java Applet use the printer?

Can a Java Applet able to print out text/html easily to standard printer driver(s) (with all common platforms Win/Mac/Linux)? Does it need to be signed? ...

How to securely trigger a Swing-Action in a restricted applet?

I simply want to call a swing action from my own popup menu. But since there is a security manager I need a solution to invoke this action without calling it directly. For instance the paste action of a text component will fail, because sun.swing.SwingUtilities2 cannot be loaded if there is any of my classes in the call stack. Is there ...

StackOverflowError when serializing an object in Java

I am writing an application in Java using Swing. I am trying to implement functionality to save and load simulation states for at simulation i am running. The entire simulation is kept as an object, disconnected from Swing. I am trying to serialize my Simulation class with this code: public void saveSimulationState(String simulationFile...

How do I assign Enter as the trigger key of all JButtons in my Java application?

I'm writing a Java Swing application using the Metal look-and-feel. Every time there is a JButton in my application the user uses the Tab key to move the focus to the button and then hits the Enter key. Nothing happens! If he hits the Space key the button events are fired. How do I assign the Enter key to trigger the same events as the S...