kellegous: Save Your Design:: We had designed the interface to have an area for local copies on the left and a (with the OSX implementation being the undisputed king of quirk). http://web.kellegous.com/ecrits/855HOME | Ok, so I'm writing a program with a GUI for the first time.. but I'm kind of a perfectionist so this is bugging me:
Frame root = new JFrame();
JPanel input_screen;
JPanel wait_screen;
JPanel result_screen;
JTextArea input;
JTextArea solution_box; Calling Java from Mathematica - Wolfram Mathematica:: A quirk of ShareKernel is that you cannot call ShareKernel and The implementation uses the Swing user interface classes, because Swing has a built- in http://reference.wolfram.com/mathematica/JLink/tutorial/CallingJavaFromMathematica.htmlHOME |
JScrollPane scroll;
...
input_screen = new JPanel();
// Create the screen where they enter the puzzle
Box box = Box.createVerticalBox();
JLabel puzzleText = new JLabel("Puzzle:");
box.add(puzzleText);
input = new JTextArea(5, 5);
box.add(input);
JButton solve = new JButton("Solve"); AWT@Everything2.com:: File Format: WAP WML - View as HTMLa new class library that implements user interface elements directly in Java. Swing provides a rich set of UI elements, and where bugs exist, at least they http://babelserver.org/babel?url=everything2.com/title/AWTHOME |
solve.setActionCommand("submit");
box.add(solve);
solve.addActionListener(this);
input_screen.add(box);
The problem is that when I type in the JTextArea, the JLabel and JButton above and below it move with the text. How can I set them to be in fixed positions? I tried containing the JTextArea in its own JPanel.. but it didn't fix it.
You can also specifiy exact positioning just incase you or anyone else is interested.
setLayout(null);
objectName.setBounds(left, top, width, height);
The layout managers are more ideal, but for small GUI applets I sometimes use exact positioning.
You need to use a layout manager to handle positioning of all of your controls. My favorite is GridLayout, and you can find out more about it here: http://java.sun.com/docs/books/tutorial/uiswing/layout/grid.html (this link also contains info on other layout managers on the left nav)
:)
Thanks Kirupa, just what I was looking for :)
BorderLayout ended up working best in this instance :D
Where's The Advantage In Windows Genuine Advantage?
Stocks Bounce After S&P Joins Bear Market
|