Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Disappearing Buttons
Disappearing Buttons [message #1859233] Mon, 22 May 2023 00:37 Go to next message
Billy Estes is currently offline Billy EstesFriend
Messages: 15
Registered: April 2023
Junior Member
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 06:29 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33148
Registered: July 2009
Senior Member
I can only repeat myself to suggest you use the WindowBuilder discussions list because they won't see your question here.

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Disappearing Buttons [message #1859249 is a reply to message #1859241] Mon, 22 May 2023 16:27 Go to previous messageGo to next message
Billy Estes is currently offline Billy EstesFriend
Messages: 15
Registered: April 2023
Junior Member
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 17:29 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33148
Registered: July 2009
Senior Member
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.)

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Disappearing Buttons [message #1859260 is a reply to message #1859250] Wed, 24 May 2023 13:33 Go to previous message
Kabiru Usman is currently offline Kabiru UsmanFriend
Messages: 42
Registered: April 2023
Member
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: Mon May 20 12:17:28 GMT 2024

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

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

Back to the top