Skip to main content



      Home
Home » Newcomers » Newcomers » Disappearing Buttons
Disappearing Buttons [message #1859233] Sun, 21 May 2023 20:37 Go to next message
Eclipse UserFriend
I am having issues with jbuttons being missing until i mouse over them on my jframe here is my jframe code

JFrame frame = new JFrame();
frame.setForeground(Color.WHITE);
frame.getContentPane().setForeground(Color.BLACK);
frame.setBounds(100, 100, 357, 539);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
frame.setVisible(true);
if you have any questions thanks in aadvance

here is my button code jusy incase

JButton btn2 = new JButton("2");
btn2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
String number = textField.getText() + btn2.getText();
textField.setText(number);
}
});
btn2.setFont(new Font("Tahoma", Font.BOLD, 23));
btn2.setBounds(139, 398, 64, 50);
frame.getContentPane().add(btn2);
Re: Disappearing Buttons [message #1859241 is a reply to message #1859233] Mon, 22 May 2023 02:29 Go to previous messageGo to next message
Eclipse UserFriend
I can only repeat myself to suggest you use the WindowBuilder discussions list because they won't see your question here.
Re: Disappearing Buttons [message #1859249 is a reply to message #1859241] Mon, 22 May 2023 12:27 Go to previous messageGo to next message
Eclipse UserFriend
yes i will but this was done by hand not in windowbuilder so i think it classifies as regular coding
Re: Disappearing Buttons [message #1859250 is a reply to message #1859249] Mon, 22 May 2023 13:29 Go to previous messageGo to next message
Eclipse UserFriend
This is not a general Java programming forum It's for asking questions about Eclipse's tools and frameworks. For general questions, ask on stackoverflow, though don't expect anyone to do your work for you. (And Google is your best friend.)
Re: Disappearing Buttons [message #1859260 is a reply to message #1859250] Wed, 24 May 2023 09:33 Go to previous message
Eclipse UserFriend
The JButton and JFrame code looks okay, but there could be a few reasons why the buttons aren't showing up until you hover over them.


  1. Painting Issues: Sometimes, Java Swing components don't show up until they're interacted with. This could be due to issues with how they're drawn on screen.
  2. Layout Management: You're using null layout for your JFrame, which can lead to issues if not handled right.
  3. Thread Issues: GUI updates in Swing need to happen on the Event Dispatch Thread (EDT). If the code adding your button isn't on this thread, it could cause problems.


Previous Topic:[SOLVED] Is there a way to stop the blank lines in imports?
Next Topic:Error installing "Marketplace Client" on "Eclipse Platform"
Goto Forum:
  


Current Time: Wed Jul 16 17:55:23 EDT 2025

Powered by FUDForum. Page generated in 0.07735 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top