NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

package lab04;
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;

public class MenuExample extends JFrame implements ActionListener{
private JMenuBar mb;
private JMenu filemenu, submenu,colormenu,editmenu;
private JMenuItem newItem1,newItem2,newItem3,newItem4,newItem5,redItem,greenItem,blueItem;
private ImageIcon icon1;
private JPanel p1;

public MenuExample() {
p1 = new JPanel();
p1.setBounds(40,60,150,150);
p1.setBackground(Color.red);


icon1 = new ImageIcon("Image/icon.png");// https://icons8.com/icons/set/package

//============ MAIN MENU BAR ======================
mb = new JMenuBar();

filemenu = new JMenu("File");
editmenu = new JMenu("Edit");
submenu = new JMenu("SubMenu");
colormenu = new JMenu("Color");

newItem1 = new JMenuItem("Item 1");
newItem2 = new JMenuItem("Item 2");
newItem3 = new JMenuItem("Item 3");
newItem4 = new JMenuItem("Item 4");
newItem5 = new JMenuItem("Item 5");

redItem = new JMenuItem("Red Item",icon1);
redItem.addActionListener(this);
blueItem = new JMenuItem("Blue Item",icon1);
blueItem.addActionListener(this);
greenItem = new JMenuItem("Green Item",icon1);
greenItem.addActionListener(this);

mb.add(filemenu);
mb.add(editmenu);

editmenu.add(colormenu);
filemenu.add(newItem1);
filemenu.add(newItem2);
filemenu.add(newItem3);

filemenu.add(submenu);
submenu.add(newItem4);
submenu.add(newItem5);

colormenu.add(redItem);
colormenu.addSeparator();
colormenu.add(blueItem);
colormenu.addSeparator(); //zuraas nemj ugnu
colormenu.add(greenItem);

this.add(p1);
this.setJMenuBar(mb);
this.setLayout(null);
this.setVisible(true);
this.setSize(400,400);
this.setTitle("Menu Example");
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if(e.getSource()==redItem) {
p1.setBackground(Color.red);
}else if(e.getSource() == blueItem) {
p1.setBackground(Color.blue);
}else if(e.getSource() == greenItem) {
p1.setBackground(Color.green);
}
}
}
//=======================================================

import java.awt.event.*;
import java.awt.*;
import javax.swing.*;

public class ScrollPane extends JFrame implements ActionListener {

private JScrollPane sp;
private JPanel p1;
private JTextArea ta1;

public ScrollPane() {
p1 = new JPanel();
p1.setBounds(0,0,180,160);
p1.setBackground(Color.red);
// p1.setLayout(new FlowLayout());

// ta1 = new JTextArea("TextArea1");
ta1 = new JTextArea(40,10);
// ta1.setBounds(0,0,80,10);
sp = new JScrollPane(p1);
sp.setBounds(40, 40, 180, 160);
p1.add(ta1);
this.add(sp);
this.setLayout(null);
this.setVisible(true);
this.setSize(400, 400);
this.setTitle("Scroll Pane Example");
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub

}
}

// netbeans
//

//============================
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.