0% found this document useful (0 votes)
70 views1 page

Java Aplikimi Me Frame

This document describes creating a GUI application window in Java using Swing and AWT packages. It creates a JFrame containing a JMenuBar with menu options, a JPanel at the bottom with a label, text field, and buttons, and a JTextArea in the center. The frame is configured to close on exit and has its size set before making it visible.

Uploaded by

Ilirian Rexho
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views1 page

Java Aplikimi Me Frame

This document describes creating a GUI application window in Java using Swing and AWT packages. It creates a JFrame containing a JMenuBar with menu options, a JPanel at the bottom with a label, text field, and buttons, and a JTextArea in the center. The frame is configured to close on exit and has its size set before making it visible.

Uploaded by

Ilirian Rexho
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

// Dritarja e nje aplikacioni me JOption

// duke perdorur paketat swing dhe awt


import javax.swing.*;
import java.awt.*;
public class gui {
public static void main(String args[]) {

// Krijimi i Frame-s
JFrame frame = new JFrame("Aplikacioni 01");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(500, 400);

// Krijimi i shiritit me menute e ndryshme


JMenuBar mb = new JMenuBar();
JMenu m1 = new JMenu("File");
JMenu m2 = new JMenu("Edit");
JMenu m3 = new JMenu("Format");
JMenu m4 = new JMenu("Help");
mb.add(m1);
mb.add(m2);
mb.add(m3);
mb.add(m4);
JMenuItem m111 = new JMenuItem("Krijo");
JMenuItem m222 = new JMenuItem("Hap");
JMenuItem m333 = new JMenuItem("Ruaj");
JMenuItem m444 = new JMenuItem("Printo");
JMenuItem m555 = new JMenuItem("Mbyll");
m1.add(m111);
m1.add(m222);
m1.add(m333);
m1.add(m444);
m1.add(m555);

// Krijimi i panelit ne fund te dritares me komponentet e saj


JPanel panel = new JPanel(); // the panel is not visible in output
JLabel label = new JLabel("Futni tekst");
JTextField tf = new JTextField(15); // accepts upto 10 characters
JButton send = new JButton("Dergo");
JButton reset = new JButton("Zero");
panel.add(label); // Components Added using Flow Layout
panel.add(label); // Components Added using Flow Layout
panel.add(tf);
panel.add(send);
panel.add(reset);

// Text Area at the Center


JTextArea ta = new JTextArea();

//Adding Components to the frame.


frame.getContentPane().add(BorderLayout.SOUTH, panel);
frame.getContentPane().add(BorderLayout.NORTH, mb);
frame.getContentPane().add(BorderLayout.CENTER, ta);
frame.setVisible(true);
}
}

You might also like