what layouts to use
posted 13 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
i finally came up with a small project to keep me busy for a while. i am writing a "copy" of windows Calculator program(in the standard view). if you have windows and could give your ideas on how to lay it out so it looks the same it would help some. so far, ignoring the menubar, i have a border layout with the TextField taking up north, and a panel with a grid layout taking center. however, this wont work because the top row has less components than the rest of the rows.
maybe if i give the panel a border layout, add a panel to it in north with a flow layout, and a panel to it in center with a grid layout?
maybe if i give the panel a border layout, add a panel to it in north with a flow layout, and a panel to it in center with a grid layout?
SCJP
Visit my download page
posted 13 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
going by the calculator in vista:
panel1 - GridLayout(1,3,5,5) for the Backspace/CE/C buttons
panel2 - GridLayout(4,5,5,5) for the numeric/operater buttons
panel3 - BorderLayout - panel1 in NORTH, panel2 in CENTER
panel4 - GridLayout(5,1,5,5) for the Memory buttons and the blank button(?)
panel5 - BorderLayout - panel4 in WEST, panel3 in CENTER
panel6 - BorderLayout - JTextfield in NORTH, panel5 in CENTER
panel1 - GridLayout(1,3,5,5) for the Backspace/CE/C buttons
panel2 - GridLayout(4,5,5,5) for the numeric/operater buttons
panel3 - BorderLayout - panel1 in NORTH, panel2 in CENTER
panel4 - GridLayout(5,1,5,5) for the Memory buttons and the blank button(?)
panel5 - BorderLayout - panel4 in WEST, panel3 in CENTER
panel6 - BorderLayout - JTextfield in NORTH, panel5 in CENTER
posted 13 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
thanks for the reply. i will give that a try. i was already thinking i needed a separate panel for the memory buttons. the "blank button" is actually an uneditable textField (or JLabel)
that is close enough. i had to make my frame width greater than the windows version(or change font size i guess), but it looks quite similar otherwise
that is close enough. i had to make my frame width greater than the windows version(or change font size i guess), but it looks quite similar otherwise
SCJP
Visit my download page
posted 13 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
i post my code so far here if anyone is interested:
SCJP
Visit my download page
Michael Dunn
Ranch Hand
Posts: 4632
posted 13 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
here's your same code a bit shorter, with a JLabel/loweredBevelBorder instead of uneditable JTextField
I had one too many panels in my first post - the one adding the textfield, which can be added directly to the frame
(will need size tweaking when menuBar added)
I had one too many panels in my first post - the one adding the textfield, which can be added directly to the frame
(will need size tweaking when menuBar added)
posted 13 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
thanks Michael, i figured out the extra panel was just the contentPane. your code is much shorter. i knew there had to be a way to loop through some of that stuff. i will look it over more closely later. i am bound to learn from it. now that i have it looking like a calculator i am finding that making it act like one is much harder. even if i dont finish it i will learn from it though. besides it is the first project idea i have had in a while. thanks again for helping me get started on it.
just compiled and ran your code. i see you managed to make it the same size as the microsoft version. now i for sure will have to read it to find out how.
just compiled and ran your code. i see you managed to make it the same size as the microsoft version. now i for sure will have to read it to find out how.
SCJP
Visit my download page
| What are you doing in my house? Get 'em tiny ad! Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing |







