Questions tagged [swingutilities]

121 questions
4
votes
2 answers

SwingUtilities.convertPoint() returns negative values

I am facing this issue in another project which has complicated JPanels structure and much code. In there I have a following snippet Point point = label.getLocation(); Point point2 = SwingUtilities.convertPoint(label.getParent(), point, panel); in…
Nikolay Kuznetsov
  • 9,467
  • 12
  • 55
  • 101
4
votes
1 answer

Component coordinates

I'm trying to get components coordinate's in relation to its parent. For example, when I have a JFrame of size 500x500, which has a child - JPanel - at [50, 10] I should get [50, 10] as a result. However easy may it seem, I'm keep getting wrong…
Robin92
  • 533
  • 1
  • 6
  • 20
3
votes
1 answer

Why do I need Swing Utilities and how do I use it?

This is mainly in regards to my question here, but I don't understand why Swing Utilities is needed and what it is used for. I'm designing a swing gui and I don't wanna miss out on anything that Swing Utilities might offer. Also could someone…
Grammin
  • 11,808
  • 22
  • 80
  • 138
3
votes
1 answer

Java GUI alignment

So I have my labels and everything added, but I am still having trouble formatting and aligning everything. The calculate button should obviously be centered. I get that using gridbag splits the frame into coordinate system and when one column is…
wade aston
  • 105
  • 3
  • 14
3
votes
2 answers

Query on creating separate thread in java?

Below is the compiled program replica of actual problem code, import javax.swing.JOptionPane; import javax.swing.SwingUtilities; public class Dummy { public static boolean getUserCheck(int size, boolean Check) { if (Check) { …
overexchange
  • 15,768
  • 30
  • 152
  • 347
3
votes
1 answer

Right click mouse event

I search through this forum but I can't find a good explanation on this topic. Is there any different from the below statements? Which way is the better way to trigger this event? if (evt.getButton() == 3) Vs. if…
searchfunction
  • 109
  • 2
  • 9
3
votes
1 answer

Swing GUI one simple thing

I have one simple question why do I need write code like this with SwingUtilities.invokeLater(new Runnable(){ If programm create same frame without it? code with SwingUtilities import javax.swing.JFrame; import…
Martynas Žukovas
  • 149
  • 1
  • 5
  • 13
3
votes
1 answer

Thread out of the EDT

Hi i'd like to do a task out of the EDT : new Thread(new Runnable(){ @Override public void run() { // TODO Auto-generated method stub fBPC.repaint(); …
3
votes
2 answers

Difference between SwingUtilities Threads and AWT.EventQueue threads

I am using using the Netbeans 7 IDE to develop a GUI desktop application. When I create the JFrame class , Netbeans uses the java.awt.EventQueue.invokeLater(new Runnable() { } To initiate the runnable object. But my application has swing…
CodeAngel
  • 569
  • 1
  • 11
  • 31
3
votes
2 answers

Add JInternalFrame to JDesktopPane using a button inside other JInternalFrame

This snippet code I got from https://stackoverflow.com/a/6868039/2240900 how to add the internal2 to desktoppane1 using a button placed somewhere in internal1. In the ActionListener added to your button you can use code like the following to get a…
3
votes
2 answers

SwingUtilities.convertMouseEvent() sets button to NOBUTTON in Java7

As we know MouseEvent gets lost in JScrollPane, i.e. not delivered to a parent, it is an old bug not fixed yet: https://forums.oracle.com/forums/thread.jspa?threadID=1362237 So I was using work-around by catching event in JScrollPane with a…
Nikolay Kuznetsov
  • 9,467
  • 12
  • 55
  • 101
3
votes
1 answer

SwingUtilities.windowForComponent(JFrame) returns null

frame is the only JFrame in my Swing app. Since JFrame extends Window I have believed from description and method name that the code should return the frame itself. SwingUtilities.windowForComponent(frame) public static Window…
Nikolay Kuznetsov
  • 9,467
  • 12
  • 55
  • 101
3
votes
3 answers

How to find location of JTree node on screen

I want to search a particular node of JTree and determine its location on screen. My aim is to start hovering mouse from the top left corner of that node and perform a mouse click in my JFC. Can anyone help me with this? Is it possible?
DarkKnight
  • 243
  • 1
  • 4
  • 10
3
votes
2 answers

SwingUtilities invokeLater GUI update with JList

Good day, I've read a few other stack overflow postings and other tutorials, but I can't get my GUI to update correctly after a button starts a long process. I've attached the full code of the problem that I am having. Notice if you run the code,…
Matthew
  • 3,886
  • 7
  • 47
  • 84
2
votes
3 answers

Java SwingUtilities.invokeLater

.addActionListener(new ActionListener(){ public void actionPerformed (ActionEvent e){ try{ ta.append("Searching Initiated at: "+datetime()+"\n"); …
user585522
  • 165
  • 1
  • 5
  • 15
1
2
3
8 9