Questions tagged as 'swing'

1
answer

How do I know if a JDialog window is open or closed?

I wanted to know, how can I tell if a screen, in my case a JDialog is open. Is there any event or way to know this? I'm going to use this "information" as a parameter in a condition, for example, if closed screen does such thing. im...
asked by 16.09.2017 / 22:55
2
answers

Format JLabel text with different colors

How can I format a JLabel and its contents with different "properties"? For example, I'd like to be able to set a color for the text of my JLabel , and another for string that is concatenated with it. It's possible? In...
asked by 06.08.2017 / 04:42
2
answers

JDialog does not draw the components in Java

I'm developing an application that will execute a processing soon, and I want a message warning that the process is running stay on the screen while it does this processing. I tried to do with JOptionPane , but since it is a modal window b...
asked by 21.03.2014 / 19:20
1
answer

How to swap the JOptionPane background with an image?

Can you use this " ImageIcon " as the background for JOptionPane ? Here is the code I tried: public static void main(String args []){ UIManager UI = new UIManager(); ImageIcon icon = new ImageIcon("Imagens/Imagem.jpg"); //D...
asked by 21.04.2017 / 01:23
1
answer

How to do this relief when hovering on a JLabel?

The board is 500x500 and each square of it is 50px, so the variables NovaPosicaoX and Y always take the border of the square where the mouse pointer is. The problem is that the relief only works in the squares of the window bord...
asked by 29.12.2016 / 18:30
1
answer

Is it possible to activate the context menu of the Operating System in swing application?

Some time ago I realized that it is not possible to call the context menu of the operating system in swing components, although it is possible to perform standard keyboard actions (such as copying, pasting, cutting, selecting) on these component...
asked by 11.01.2017 / 13:22
1
answer

What's the difference between using SwingUtilities.invokeLater (Runnable) and EventQueue.invokeLater (Runnable) when invoking a window?

I was reading this answer where you talk about using EDT to manipulate swing components, but there it is suggested to use one of the two methods quoted to" dispatch "the interface to EDT. > There is a difference between using SwingUtil...
asked by 11.01.2017 / 14:05
2
answers

Button click event

Add some buttons like this: JButton bt; for(int i = 0; i <= 10; i++){ bt = new JButton("BT : " + i); bt.setPreferredSize(new Dimension(80, 80)); bt.addActionListener(new ActionListener() { @Override public void a...
asked by 17.03.2016 / 21:02
1
answer

Change the size of the TAB spacing in JTextPane

I want to change the tab tab of jTextPane because it has many spaces, for example: Currently it looks like this: Uma casa azul // após TAB Uma casa azul And what I want would be like this: Uma casa azul // após TA...
asked by 20.10.2016 / 14:42
2
answers

How to get the type of component clicked?

The getSource () method returns the event source, is there any method that returns the event source type, whether it was a jlabel, or jbutton, something like this?     
asked by 06.12.2015 / 22:27