Skip to main content

All Questions

Tagged with
0 votes
2 answers
63 views

Component not visible after using "setVisible(true)" on it and its parent

I've got a Java 8 app with a couple of JTextFields and a JButton to log into a database and a JTextArea inside a JScrollPane to display errors. Both the textarea and the scrollpane have to be hidden (...
Neph's user avatar
  • 1,933
0 votes
0 answers
38 views

Adding JPanel on another JPanel on button press

I have created a MainPanel in which I make a bird fly. To this panel, I have to add a PausePanel panel at the press of a button. If I only use pausePanel.setVisible (true / false) when pressing the ...
ilMichigan's user avatar
0 votes
1 answer
445 views

Changing the visibilty of a label

i'm new to Java and experience a little bit with the WindowBuilder. I want to change the visibility of a different components like labels or textfields. So I wrote an example code: the function is, ...
N T's user avatar
  • 3
0 votes
1 answer
81 views

JButton Only Works When Visibility is Set to True-Java

I am trying to make a simple checkers game basically, and I need the user to only be able to see the tiles and the pieces, not the button. When I set the visibility to True, the program works by ...
Sean.D's user avatar
  • 97
0 votes
1 answer
373 views

JPanel inside JFrame doesn't show content sometimes. Why?

I managed to fix it but I don't understand why the same code results in different results. Some classmates have had the same problem. The issue is that it I use miVentana.setVisible(true); before ...
Juan Antonio Rodríguez Gabriel's user avatar
0 votes
2 answers
475 views

How can I set visible to hide the jDialog (inside if condition) that is set visible shown (outside if loop)?

Here I want to open a DialogFrame containing an error message when a buttonGroup is not active & the search button is clicked. So inside the ActionEvent I have made the DialogFrame to setVisible(...
R tr's user avatar
  • 5
0 votes
1 answer
67 views

Getting the isSelected value of a selected radiobutton in separate class

I realise this is probably the definition of a noob question but I'm pretty stuck and would greatly appreciate any help. I have an actionlistener and JRadioButton which is declared in the ...
VICWICIV's user avatar
1 vote
1 answer
54 views

JTextArea not visible

Here is my code. I have tried to keep it very simple. public class GUI_ADV extends JFrame { public static void main(String[] args) { NewClass abc = new NewClass(); abc.setLayout(...
user avatar
-1 votes
1 answer
103 views

Component array returned by getComponents() method can be changed

I'm trying to set a pressed button invisible and set the rest visible. I used getComponents() method to get the three buttons and change its visibility state but something goes wrong. @Override ...
Bruno's user avatar
  • 1
-1 votes
2 answers
440 views

jLabel won't show

I am slightly confused, I have a jFrame of which I have made in Netbeans. This jFrame has a jLabel, of which is set to setVisible(false); from the beginning. Whenever a specific method is called, I ...
Sm00rf9000's user avatar
-2 votes
2 answers
173 views

How to set a GUI non-visible within the constructor?

I have a swing GUI class Foo and in the constructor of Foo class, I load some values from the databases. Based on the returning values from database, I can say whether this GUI should be visible or ...
drJava's user avatar
  • 767
0 votes
0 answers
169 views

JList is hiding the selected element

I have a JList that is built off of a DefaultListModel. I also have a ListSelectionListener added onto the list. I don't know why, but whenever I select an item on the list, it correctly chooses it ...
Nate Cowley's user avatar
2 votes
1 answer
1k views

What determines component visibility in Java?

I'm writing a Java GUI program that uses a JFrame object and several JPanel objects. The JPanel objects use the paint() and repaint() methods, and some of the JPanel ojbects have JLabels and JButtons. ...
danger mouse's user avatar
  • 1,477
0 votes
1 answer
177 views

JButton size is set to default size when visibility is changed

Like I said the JButton GR is set to the default size (size of window) when I click JButton MN. When the program is started the JButton GR has the right size (200 by 20), when clicked the menu button ...
BEN2006's user avatar
0 votes
0 answers
33 views

Java Swing - Elements not showing up until mouse hovers over it [duplicate]

I'm currently in the process of programming a Calculator. I have a JFrame, with a JPanel that has all the various elements on it (JButtons, TextArea). However, when the program first starts running, ...
Salmononius2's user avatar

15 30 50 per page
1
2 3 4 5