swing

Using paintThumb I've made my arrow fall off the JSlider when at 0 or 100, how can this be fixed?

The picture explains it all. I've painted a new Thumb and it goes off the JSlider area when at higher than 95 or below 5. I've tried padding the Track with no success. Does anyone have any tips? Here is my code. I believe my issue is fine turning the size of the thumb under the getThumbSize override. private static class MySliderUI ...

Workaround for JFormattedTextField delete bug in Java for Mac OS X 10.6 Update 2 (1.6.0_20)

There is apparently a bug introduced in the latest Java update for Mac OS X, which causes deletes in JFormattedTextFields to be performed twice. See http://lists.apple.com/archives/java-dev/2010/May/msg00092.html The DefaultEditorKit.deletePrevCharAction is invoked twice when the delete key is pressed. Are there any suggestions for a w...

Components don't show in custom JPanel/JComponent

I've created a custom swing component. I can see it (the grid from the paint method is drawn), but the buttons that are added (verified by println) aren't shown. What am I doing wrong? Background information: I'm trying to build a tree of visible objects like the Flash/AS3 display list. public class MapPanel extends JComponent { // or ...

repaint problem

I have a problem with my repaint in the method move. I dont know what to doo, the code is below import java.awt.*; import java.io.*; import java.text.*; import java.util.*; import javax.sound.sampled.*; import javax.swing.*; import javax.swing.Timer; import java.awt.event.*; import java.lang.*; public class bbb extends JPanel { ...

Help with Java Swing HTML parsing

I am parsing a collection of HTML documents with the Java Swing HTML parsing libraries and I am trying to isolate the text between <title> tags so that I can use them to identify the documents but I am having a hard time accomplishing that since the handleStartTag method doesn't have access to the text inside of the tags ...

Rendering Dragged object during drag

Hello, I have been stuck on this problem for a while now. I want to drag a row in a jtable to reorder it. But I really want the user to see the row while dragging it and not just the default "drag" rectangle symbol. So I took a look at the java DnD tutorial finding it very useful, but.. The problem is that I still dont know which meth...

Unable to set mouse cursor JLayeredPane

I'm running into a problem that I can't seem to figure out nor find the answer anywhere on the web. I've got a JLayeredPane and when it only has one child Panel I am able to correctly set the cursor using setCursor(). The cursor shows up and everything is fine. But when I add an additional JPanel into the JLayeredPane the cursor no long...

Java Swing for emulation

I am planning to create a GUI for an emulation process using Java Swing. I would like to kindly ask if anyone could provide me some basic information about the technologies that I may need for the development of Java applications which handle emulation processes. ...

How to bring JDialog to the top

I have created a java application. Now I write that if the JDialog is not present then It will create another JDialog but If its present then i set it as setVisible as true. But the problem is that if JDialog is there and after that i opened other applications like internet explorer then my application is not shown on top. So i made setA...

how to draw rectangle around mouse cursor in java?

hey guys i had made one module in my project, on which user can draw any thing using pencil now i want to create eraser for that drawing module so i need that as soon as user click on that eraser button then, around my mouse cursor i want little rectangle shape around it. so user can use it to erase the some parts in drawing. may be smi...

creating splash screen

Hi All, How to create a splash screen as like netbeans or eclipse splash screen. Please help me for this Regards, Chandu ...

Running a swing application programmatically (remote classes)

Dear Friends, I have a slightly complicated case where I do not have source code (or the compiled class) the swing application that I am trying to run automatically. I will try to do a series of tasks on this application, press some buttons, click on some parts etc. I want to be able to do this programatically. Every single swing de...

Can I set the ButtonUI for only a subset of JButton classes?

I want to create a button class and use a ButtonUI to render it instead of overriding the paint component method. I do not want to use this ButtonUI for ALL JButtons. Is that possible? I've only ever seen UIManager.put("ButtonUI","MyCustomButtonUI"), but does this affect ALL JButton rendering? Is it possible to limit the scope of the pu...

JTable custom header renderer that looks like other headers with nimbus look and feel?

Any time I create a custom header renderer for a JTable it ends up not looking correct with the nimbus look and feel. The default table headers have a silvery gradient, custom renderers do not look that way. In the past I just avoided creating custom header renderers. Is it possible to copy the default look onto my new custom renderer? B...

AWTUtilities.setWindowOpaque is causing some text painting issues

I am attempting to create an opaque JWindow with antialiased rounded corners. In doing so, I call the method: AWTUtilities.setWindowOpaque(this, false); And use a custom JPanel which paints the actual rounded corners. Within the window, I have a JList. Whenever setWindowOpaque is set to false, the text within the JList becomes "disto...

What is the best way to put spaces between objects? Can a Swing JSeparator object be an invisible separator?

I am learning Swing, and finding the behaviour of the JSeparator a bit surprising. I am trying to put two buttons inside a panel using Swing widgets, inside the NetBeans IDE, my JSeparator "border" property is set to "(No border)" in the properties pane. Nevertheless a line appears. This is not what I would expect from a separator o...

How can I use Java to read/draw/interact with another Java window/applet

I am interested in writing a Java program which does the following. Attach to a currently running Swing window or applet, running in another JVM Alternatively, load a Java application so as to be able to do the above Read colors from the window Send mouse and keyboard events to the window I am hoping to make some sort of testing an...

Learning Eclipse Visual Editor Swing with Java

I am trying to create a java GUI project for school using Eclipse Visual Editor with Swing. But i am having a lot of issues learning this since this is the first time i am making a GUI. Like when i drag JPanel into my screen, it creates a function for it, but how do i call it in a separate file? I guess my question is does anyone know...

JComobox is not showing in the JDialog

I have 2 classes. when I put bold 3 lines in the method addCourses() the dialog does not show combobox in the Panel but when I remove from addCourses and put those bold lines in the constructor, JComboBox are shown in the Panel. But data will not show because data items updates to ComboBox will happen after Constructor is created. How ...

Java Swing Visual Editor HELP please

How would i call this function in my main? private JFrame getMainpageframe1() { if (mainpageframe1 == null) { mainpageframe1 = new JFrame(); mainpageframe1.setSize(new Dimension(315, 306)); mainpageframe1.setContentPane(getMainpage()); mainpageframe1.setTitle("Shopping For Less: Main Page"); ...