Closed billykd4dpb closed 1 year ago
Here is my issue. I have a frame with label, jtextfield, and 2 buttons when you run the program the label and the textfield show but the butttons dont until you mouse over them.
I don't think that's necessarily a WindowBuilder bug but just how Swing behaves. The primary issues seems to be that you call frame.setVisible(true)
, before adding the buttons. Because you also don't use a layout, there is no incentive for Swing to redraw the button area. That is until you hover over them.
In short, there are two ways to fix this:
frame.setVisible(true);
at the end of the method, once everything has been added.The latter one is the more elegant and also more stable solution.
When i try to run the Scientific Caalculator it has the messages the"cannot refer to nonfinal verible in scope.
That's sadly not something I could reproduce with the code snippet you provided. Which version of WindowBuilder are you using? Almost any newer version should require at least Java 11, so I find it odd that you mention Java 8.
@ptziegler
Note that this above is hand written code and is not using WindowBuilder as also appears in this thread:
https://www.eclipse.org/forums/index.php?t=msg&th=1113069&goto=1859241&#msg_1859241
This should be a discussion but I cannot convert it.
Here is my issue. I have a frame with label, jtextfield, and 2 buttons when you run the program the label and the textfield show but the butttons dont until you mouse over them. i was told i needed to post here from eclipse forum even though this is cut and paist from a you tube video but didnt run using winbuilder. When i try to run the Scientific Caalculator it has the messages the"cannot refer to nonfinal verible in scope. i am running ubuntu linux and openjdk 8.0 here is my code import java.awt.Color; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener;
//import javax.swing.ButtonGroup; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField;
public class SC4 { static JFrame frame; static JTextField textField;