Results 1 to 2 of 2
Thread: Setting position of JButton
- 01-19-2013, 02:48 AM #1
Member
- Join Date
- Jan 2013
- Posts
- 3
- Rep Power
- 0
Setting position of JButton

How can I put button marked with red square, at the bottom left corner of JFrame?
Code is
Java Code:import java.awt.*; import javax.swing.*; public class SettingsWindow { JFrame f; JButton b1, b2, b3; public SettingsWindow() { f = new JFrame ("Settings") ; f.setSize(400, 400) ; ImageIcon TempuratureIc = new ImageIcon("heat.png"); b1 = new JButton(TempuratureIc); b1.setFocusPainted(false); //b1.setBorderPainted(false); b1.setContentAreaFilled(false); ImageIcon TimeIc = new ImageIcon("timetable.png"); b2 = new JButton(TimeIc); b2.setFocusPainted(false); //b2.setBorderPainted(false); b2.setContentAreaFilled(false); ImageIcon ProfileIc = new ImageIcon("graph.png"); b3 = new JButton(ProfileIc); b3.setFocusPainted(false); //b3.setBorderPainted(false); b3.setContentAreaFilled(false); f.add(b1); f.add(b2); f.add(b3); b1.setToolTipText("Temperature Settings"); b2.setToolTipText("Time Settings"); b3.setToolTipText("Profile Settings"); System.out.println(System.getProperty("user.dir")); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setLayout(new FlowLayout()); f.setVisible(true); } public static void main(String[] arg) { SettingsWindow w = new SettingsWindow() ; } }
- 01-19-2013, 06:19 AM #2
Re: Setting position of JButton
Lesson: Laying Out Components Within a Container (The Java™ Tutorials > Creating a GUI With JFC/Swing)
Why don't you just go through the whole Swing tutorial trail?
dbWhy do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
Setting JButton's mousedown state
By 0026sd in forum AWT / SwingReplies: 6Last Post: 12-14-2011, 08:06 PM -
ActionListener for JButton after changing Button to JButton
By ravi.joshi53 in forum Java AppletsReplies: 2Last Post: 10-07-2011, 07:35 AM -
setting JButton setEnabled() outside of main class
By danborgir in forum New To JavaReplies: 11Last Post: 05-07-2011, 04:03 PM -
[SOLVED] [newbie] AbstractButton.setText() not setting text within JButton
By jon80 in forum New To JavaReplies: 3Last Post: 05-25-2009, 03:33 AM -
get position in string from caret position
By helloworld111 in forum AWT / SwingReplies: 5Last Post: 02-19-2009, 01:36 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks