Use IntelliJ create a Java GUI window program that contains all the interface co
ID: 3598163 • Letter: U
Question
Use IntelliJ create a Java GUI window program that contains all the interface components covered in the lecture.
JPanel - Green with Yellow text
JButton - four buttons
JLabel - four labels
JTextField - three text fields
JPasswordField - one is fine
JCheckBox - four different birds
JComboBox - four different flowers
JList - three different bikes
JSlider - goes up to max 100 at 10 increments
JMenu - contains File with pull down options-> save -> save all
please provide output pictures thank you!
Explanation / Answer
JPanel
public class IntellijExample extends Frame(){
private JPanel root;
private JPanel fieldpanel;
private JPanel panel1;
public IntelliJExample(){
panel1.setLayout(new BoxLayout(panel1,green));
setContentPane(root);
pack();
public void action(){
JTextField newField=new JTextField();
panel1.add(JTextField);
fieldpanel.add(panel1);
pack();
repaint();
}}
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}
private void UIComponent(){
fieldpanel=new JPanel();
panel1=new Jpanel();
}
----------------------------------
button
JFrame fr=new JFrame();
JButton b1=new JButton(one);
b1.setBounds(50,100,50,100);
JButton b2=new JButton(two);
b2.setBounds(50,100,50,100);
JButton b1=new JButton(one);
b3.setBounds(50,100,50,100);
JButton b1=new JButton(one);
b4.setBounds(50,100,50,100);
fr.add(b);
-----------------------------
label
JFrame fr=new JFrame();
JLabel l1=new JLabel(first label);
l1.setBounds(50,100,50,100);
JLabel l2=new JLabel(second label);
l2.setBounds(50,100,50,100);
JLabel l3=new JLabel(third);
l3.setBounds(50,100,50,100);
JLabel l4=new JLabel(four);
l4.setBounds(50,100,50,100);
fr.add(l1);
fr.add(l2);
fr.add(l3);
fr.add(l4);
-----------------
Text Field
JFrame fr=new JFrame();
JTextField t1=new JTextField(first);
t1.setBounds(50,100,50,100);
JTextField t2=new JTextField(second);
t2.setBounds(50,100,50,100);
JTextField t3=new JTextField(third);
t3.setBounds(50,100,50,100);
fr.add(l1);
fr.add(l2);
fr.add(l3);
-------------------------
password
JFrame f= newJFrame();
JPasswordField pf= new JPasswordField();
JLabel lb=new JLabel("password");
lb.setBounds(50,100,50,100);
pf.setBounds(50,100,50,100);
f.add(pf); f.add(lb);
-------------------------------
checkbox
JFrame f= newJFrame();
JCheckbox ckb1=new JCheckbox("pigeon");
ckb1.setBounds(50,100,50,100);
JCheckbox cbk2=new JCheckbox("sparrow");
ckb2.setBounds(50,100,50,100);
JCheckbox cbk3=new JCheckbox("crow);
ckb3.setBounds(50,100,50,100);
JCheckbox cbk4=new JCheckbox("crow");
ckb4.setBounds(50,100,50,100);
f.add(cbk1);
f.add(cbk2);
f.add(cbk3);
f.add(cbk4);
------------------
combo box
JFrame f=new JFrame();
String flower[]={"lotus","rose","lilly","aster"};
JComboBox cb1=new JComboBox(flower);
cb1.setBounds(50,100,50,100);
f.add(cb1);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.