I am working on developing an on-screen keyboard with java. This keyboard has a JComponent for every possible key. When a mouse down is detected on the button, I want to send a specific keyboard code to the application currently on focus. The keyboard itself is within a JFrame with no decorations and set to always-on-top.
I found tha...
I have a JLabel (actually, it is a JXLabel).
I have put an icon and text on it.
Now I wand to add some spacing on the left side of the component, like this:
I DON'T accept suggestion to move the JLabel or add spacing by modifying the image.
I just want to know how to do it with plain java code.
...
I'm trying to write a resolution selection dialog that pops up when a program first starts up. To prevent boring the user, I want to implement the fairly standard feature that you can turn off that dialog with a checkbox, but get it back by holding down the alt key at startup.
Unfortunately, there is no obvious way to ask java whether a...
I am very likely to be starting a new project at work and will need to use the Java Swing library. I would like to get up to speed pretty quickly, preferably in the next two months. What do you consider to be the best documentation (either online or in book form) to help me get a solid grasp on the library?
...
I'm trying to get into java again (it's been a few years). I never really did any GUI coding in java. I've been using Netbeans to get started with this.
When using winforms in C# at work I use a usercontrols to build parts of my UI and add them to forms dynamically.
Ive been trying to use JPanels like usercontrols in C#. I created a J...
I have applied a Formatter to a JFormattedTextField using a FormatterFactory, when a user clicks into the text field I want to select the contents.
A focus listener does not work as expected because the formatter gets called, which eventually causes the value to be reset which ultimately de-selects the fields contents. I think what is ...
I'm working with a combobox in a Swing-based application, and I'm having a hard time figuring out what to do to differentiate between an ItemEvent that is generated from a user event vs one caused by the application.
For instance, Lets say I have a combobox, 'combo' and I'm listening for itemStateChanged events with my ItemListener, 'l...
I have the following code:
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
public class ScratchPad {
public static void main(String args[]) throws Exception {
String html ="<html>"+
"<head>"+
"<meta http-equiv=\"Content-Type\" content=\"tex...
I've often heard criticism of the lack of thread safety in the Swing libraries.
Yet, I am not sure as to what I would be doing in my own code with could cause issues:
In what situations does the fact Swing is not thread safe come into play ?
What should I actively avoid doing ?
...
Full disclaimer: I'm a CS student, and this question is related to a recently assigned Java program for Object-Oriented Programming. Although we've done some console stuff, this is the first time we've worked with a GUI and Swing or Awt. We were given some code that created a window with some text and a button that rotated through differ...
What is required of an updated and legacy free Graphical User Interface API for Java?
//TODO: Add your ideas below.
...
The following ListCellRenderer does not receive click events on the nested ComboBoxes. Do I need to enable something?
class FilterCellRenderer implements ListCellRenderer {
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
Filter filter = (Filter)...
I would like to dynamically create a minimal transparent bar graph to display over a canvas.
I was thinking of using a custom renderer for a JButton or a JLabel; but how do I draw my bar graph in this renderer?
...
which library better for faster java application swt or swing?
...
The rich text editor must be implemented in Java, provide Swing support, and preferably be open source.
I'm looking to integrate it into an existing Java/Swing application.
Thanks.
...
Ok so ive got a bitchin swing app going using the "System" look and feel.
Now, I want to change the background colour of the main panels to black.
Too easy right?
UIManager.put("Panel.background", Color.BLACK);
Well yeah, except now the controls in the app look stupid, because their 'shadows', for want of a better word, are graduated...
I have a swing application that includes radio buttons on a form. I have the ButtonGroup, however, looking at the available methods, I can't seem to get the name of the selected JRadioButton. Here's what I can tell so far:
From ButtonGroup, I can perform a getSelection() to return the ButtonModel. From there, I can perform a getActi...
Using Java swing, what is the string that correspond to a correct email mask when using the MaskFormatter?
Is that possible at all to actually use a MaskFormatter for emails?
...
I'm trying to figure out a way to add a self-update feature to a Java/Swing application I'm working on.
Basically I've got a bunch of jar files with extra functionality to be re-deployed to the installed users when they change. Nothing complicated, just check if a new version has been released, download them over HTTP, and then optional...
Hello
First of all, using gnome is not an option (but it is possible to install its libraries).
I need to know what is necessary to display a Java Swing desktop application using the current installed KDE look and feel of KDE. Ideally, the solution should allow me to apply a look and feel that looks like the underlying windowing system...