import java.awt.*;
import javax.swing.*;
public class TestLayout
{
JFrame f;
MyGridLayout(){
f=new JFrame();
JButton b1=new JButton("1");
JButton b2=new JButton("2");
JButton b3=new JButton("3");
JButton b4=new JButton("4");
JButton b5=new JButton("5");
JButton b6=new JButton("6");
JButton b7=new JButton("7");
JButton b8=new JButton("8");
JButton b9=new JButton("9");
JButton bs=new JButton("*");
JButton b0=new JButton("0");
JButton bh=new JButton("#");
f.add(b1);f.add(b2);f.add(b3);f.add(b4);f.add(b5);
f.add(b6);f.add(b7);f.add(b8);f.add(b9);f.add(bs);
f.add(b0);f.add(bh);
f.setLayout(new GridLayout(4,3));
//setting grid layout of 4 rows and 3 columns
f.setSize(300,300);
f.setVisible(true);
}
public static void main(String[] args)
{
new TestLayout();
}
}
The output is
Grid Layout creates a rectangular grid of specified rows and columns.
So, the answer is
new GridLayout(4, 3)
pts Which layout manager constructor call would be best-suited to create a telephone keypad GUI which...
In the field create: Two Font objects. Call them nameFont and dateFont. Set them to whatever name, style, and size that you wish. Just make sure they are different. Two Color objects. Call them nameColor and dateColor. In one use the whole number constructor to create a custom color for your name. In the other use the constructor that takes floating point numbers as percentages to create a color for the date. An instance of the content pane so that...
I have this problem for a final thats in my book thats i'm stuck on . Any help would be really appreciated. Design and code a Swing GUI to translate text that is input in English into Pig Latin. You can assume that the sentence contains no punctuation. The rules for Pig Latin are as follows: ⦁ For words that begin with consonants, move the leading consonant to the end of the word and add “ay.” For example, “ball” becomes...
Please try to write the code with Project 1,2 and 3 in mind. And use java language, thank you very much. Create an Edit Menu in your GUI Add a second menu to the GUI called Edit which will have one menu item called Search. Clicking on search should prompt the user using a JOptionPane input dialog to enter a car make. The GUI should then display only cars of that make. You will need to write a second menu...