swing

problem in adding image to JFrame

Hi, I'm having problems in adding a picture into JFrame, something is missing probebly or written wrong. here are the classes: main class: public class Tester { public static void main(String args[]) { BorderLayoutFrame borderLayoutFrame = new BorderLayoutFrame(); borderLayoutFrame.setDefau...

Netbeans GUI editor problems

Hey guys. Im making a portion of my app using the netbeans gui editor. Great so far. However ive added a new checkbox - and when i load the panel in my app the text attribute isnt shown...its just blank as if i have no caption on it... all the other ones display - so this is very annoying. It kind of seems that I have hit the limit on ...

Problem painting JLabel class to another JPanel class

I have created a class that extends JLabel to use as my object moving around a JPanel for a game. import javax.swing.*; public class Head extends JLabel { int xpos; int ypos; int xvel; int yvel; ImageIcon chickie = new ImageIcon( "C:\\Users\\jjpotter.MSDOM1\\Pictures\\clavalle.jpg"); JLabel myLabel = new JLabel(chickie...

GridBagConstraints weightx and weighty values

In many books weightx and weighty values are expressed in different ways: some says 0.0 to 1.0 other says 0 to 100 other say until 1000 I'm a lot confused. In the API these variables are double types so I think the first is correct but what does it meaning a value of 0.4 or 0.7? are percentage values, point values? relative of what? ...

Swing GUI using JNI crashes

Hi, A java swing application(GUI) using JNI code to communicate with native C code. The Swing application launches properly and works fine. The GUI is used to start some customized system level tests(io,memory,cpu) and show their progress. The tests have to be left running at-least overnight to get the results. But, the next morning,...

How can I change the arrow style in a JComboBox

Let's say I want to use a custom image for the arrow in JComboBox, how can I do this? I understand it's possible using the synth xml files, or maybe even UIManager.put(...), but I don't know how. All I want to do at this time is change the arrow image to something else, either programatically or even just overriding the image it uses. ...

JTable - Getting a cell into Edit mode on pressing Tab

This is possibly has a trivial solution, but I am at the end of my tether so I hope somebody can help out. I use a JTable which has a custom renderer and a custom editor for a set of columns. The renderer uses a JLabel component and the editor uses a JSpinner component. Our users want to be able to enter values in a column, and then pre...

JTable cells not rendering shapes properly

I'm trying to render my JTable cells with a subclassed JPanel and the cells should appear as coloured rectangles with a circle drawn on them. When the table displays initially everything looks OK but then when a dialog or something is displayed over the cells when it is removed the cells that have been covered do not rendered properly an...

Swing verify code on event dispatch thread at runtime

Are there any libraries that instrument code to verify that methods called on swing components are called on the event dispatch thread? It probably wouldn't be too difficult to write some basic code for doing this, but I'm sure there are edge cases and whatnot that other people have handled. I'm looking for this at runtime though, not fo...

How to add ONLY system tray icon to application?

I am developing an application that will be running behind the scenes in Windows and would like to put an icon in the system tray for troubleshooting purposes (simple way for users to tell if the app is running). There is no other UI for the application, and the icon does not need to have any functionality as of right now. All of the so...

How to implement a tiered "selection tree" in Swing? (Or: is there an existing implementation?)

I need a Swing component that will let me display a tree-structured list of items, and allow the user to select or de-select an arbitrary subset of those items, with the ability to select or deselect an entire subtree's worth of components by picking that subtree's parent. (Basically, something similar to the Eclipse "Export JAR file's"...

Why do people run Java GUI's on the Event Queue

In Java, to create and show a new JFrame, I simply do this: public static void main(String[] args) { new MyCustomFrameClass().setVisible(true); } However, I have seen many people doing it like this: public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { ne...

Adding KeyListener to a JWindow not getting any key events

Hello everyone, In Java, I am adding a KeyListener to a JWindow, but it is not getting any key events. If I used the same code but extend a JFrame instead, then everything works fine. public class MyWindow extends JWindow { ... ... private void initComponents() { ... ... addKeyListener(new KeyListene...

Creating a custom device for Swing/AWT to draw to

I am working on an embedded linux device that requires custom java code to draw to the screen. I was wondering if there was any way to create a custom adapter that can update the display based off our drawing code. I have done some digging and haven't found any information as to how Devices are implemented or plugged into Swing/AWT. Any ...

Java Swing: How to make the JComboxBox drop down list taller?

How to make the "dropdown" (or "popup", I don't know how it's called) of a JComboBox taller on the screen? By default, when I open my JComboBox I see, say, 7 out of 29 items, then I need to scroll. What should I do so that I can see, say, 15 out of these 32 items? (or if the dropdown is, say, 150 pixels tall, how can I make it 300 pixe...

how set vertical marquee in java application?

Hi, I am creating one application in java using swing.In that i have an array of String, I try to use html marquee tag to scroll all the strings one by one from top to bottom.But the marquee tag doesn't support in the panel. How can i acheive it.Can any one suggest me? Thanks i...

Custom implementation of TreeModel refuses to repaint after call to treeNodesInserted

I'm using a custom TreeModel for a JTree. I have an issue when I insert a new node into my TreeModel, and then call treeNodesInserted(TreeModelEvent) on all my TreeModelListeners. I think the issue has to do with the fact that JTree.TreeModelHandler has no implementation for treeNodesInserted(e), only treeStructureChanged(e) obviously ...

JTree : leaf icon replaced by bullets !

Hello, I did some package and jar refactoring in my application and now I have several look&feel issues. - The one which is easier to explain is that in JTree (embedded within a JXTreeTable), I no longer have "leaf" (file) icon but gray bullet instead... - Another one is that the default font in TextArea became 'Courier', I hade to for...

How to get the name of global active window using Java??

I am work an Desktop Application in which i need to save the name of corrently focused or active window name(mozilla firefox, or any other file name) in an text file currently I am using getActiveWindow() method of KeyboardFocusManager which give the name of active Window, or null if the active Window is not a member of the calling threa...

Draw a JButton to look like a JLabel (or at least without the button edge?)

I've got a JButton that for various reasons I want to act like a button, but look like a JLabel. It doesn't actually have to be a JLabel under the hood, I just don't want the raised button edge to show up. Is there an easy way to turn off the "button look" for JButtons but keep all the button functionality? I could build some kind of ...