I would like to write test cases for a GUI. I want to know how do you simulate a click of JButton, or how do you extract the elements of a JTable. For the purpose of this, I have built a simple GUI that increase the count by 1 if the button is clicked and the JTextfield is empty, but
Tag: swing
Resize a picture to fit a JLabel
I’m trying to make a picture fit a JLabel. I wish to reduce the picture dimensions to something more appropriate for my Swing JPanel. I tried with setPreferredSize but it doesn’t work. I’m wondering if there is a simple way to do it? Should I scale the image for this purpose? Answer Outline …
Getting JTextArea to display fixed-width font without antialiasing
Does anybody know how to get JTextArea to display a fixed size font on all platforms? I want to make a simple code editor with save/open functionality, which is simple enough, but I would like to get font to be fixed-size, preferably courier new. The problem is that courier new is proprietary apparently, and …
How to make a splash screen for GUI?
Hi there I’m new to GUIs in Java and was trying to make a splash screen or an image appear for 3 seconds. Then after that it it will go onto my main program. Does anyone have an ideas how to do this or can link me to any tutorials? So far I have done this but not sure where
Java Radio Button Variable Errors
So this works now, and i fixed the variable calling errors. but I get : My GUI Pops up but is blank, what is it now? I cannot figure out what the problem is at this time. This is very important to get resolved, thank you in advance. Answer the first error means when you call buildPanel(String, String) you nee…
java.lang.NoClassDefFoundError while reading a svg file as BufferedImage
i have a .svg file to create a Map which will have Listeners relevant to boundaries (i guess its called “nodes” of a scalable vector graphic). However, i’m trying to add this file as a BufferedImage over a JPanel. (i’m a newbie about swing components so if you have any better ideas ple…
Porting a Java app that uses AWT and Swing for drawing movies to the server-side
I am working with some code that writes animated output to the desktop using AWT and Swing features. It draws using 2D graphics and renders text in fonts. This code can use the Java Media Framework to save the animationto movie files. I would like to port this code to a pure server-side environment, for worki…
Implementing Cursor in Java with some Transparency
I have a 35×40 px. png image I want to use as a custom cursor in a Swing application. The image has a glow so contains alpha transparency values. Problem is when I attempt to use the conventional method of using the Toolkit to generate the custom cursor I get black pixels where alpha transparency values …
Random errors when changing series using JFreeChart
I’m making a GUI that display result of background calculations. But before that, I wanted to test changing the dataset. Here is my code: As you can see, I want to change points on the graph (every time it finishes ‘some complicated computations’) – this change is in the thread invoked…
Using custom TableModel make isCellEditable true for a particular row on button click
I have a table like above. Initially all the cells except button column are not editable. I have created the table using custom TableModel. My isCellEditable in custom TableModel looks like this: But when I click on the Edit button of each row a JDialog will pop up with that row (by constructing a JTable in t…