Ver código fonte

Added gui Package and Classes

Check it
Supermaniac101 11 anos atrás
pai
commit
1ab6628a50

+ 23 - 0
src/gui/frames/MainFrame.java

@@ -0,0 +1,23 @@
+package frames;
+
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+
+@SuppressWarnings("serial")
+public class MainFrame extends JFrame{
+	
+		public MainFrame(JPanel panel){
+		this.add(panel);
+		this.setResizable(false);
+		this.setBounds(100,100,1440,900);
+		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+		this.setUndecorated(false);
+		this.setJMenuBar(new MenuBar());
+		this.setVisible(true);
+		
+		}
+		
+		
+		
+		
+}

+ 73 - 0
src/gui/frames/MenuBar.java

@@ -0,0 +1,73 @@
+package frames;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+
+@SuppressWarnings("serial")
+public class MenuBar extends JMenuBar{
+
+	public MenuBar(){
+		initialize();
+	}
+	
+	private void initialize(){
+		JMenu fileMenu = new JMenu("File");
+        JMenu editMenu = new JMenu("Edit");
+        JMenu viewMenu = new JMenu("View");
+        JMenu helpMenu = new JMenu("Help");
+        this.add(fileMenu);
+        this.add(editMenu);
+        this.add(viewMenu);
+        this.add(helpMenu);
+        
+        JMenuItem newAction = new JMenuItem("New");
+        JMenuItem openAction = new JMenuItem("Open");
+        JMenuItem exitAction = new JMenuItem("Exit");
+        JMenuItem cutAction = new JMenuItem("Cut");
+        JMenuItem copyAction = new JMenuItem("Copy");
+        JMenuItem pasteAction = new JMenuItem("Paste");
+        
+        fileMenu.add(newAction);
+        newAction.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent arg0) {
+                System.out.println("You have clicked on the new action");
+            }
+        });
+        fileMenu.add(openAction);
+        openAction.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent arg0) {
+                System.out.println("You have clicked on the open action");
+            }
+        });
+        fileMenu.addSeparator();
+        fileMenu.add(exitAction);
+        exitAction.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent arg0) {
+                System.exit(0);
+            }
+        });
+        editMenu.add(cutAction);
+        cutAction.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent arg0) {
+                System.out.println("You have clicked on the cut action");
+            }
+        });
+        editMenu.add(copyAction);
+        copyAction.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent arg0) {
+                System.out.println("You have clicked on the copy action");
+            }
+        });
+        editMenu.add(pasteAction);
+        pasteAction.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent arg0) {
+                System.out.println("You have clicked on the paste action");
+            }
+        });
+	}
+	
+}

+ 13 - 0
src/gui/main/Main.java

@@ -0,0 +1,13 @@
+package main;
+
+import panels.MainPanel;
+import frames.MainFrame;
+
+
+public class Main {
+	
+	public static void main(String[] args){
+		new MainFrame(new MainPanel());
+	}
+}
+	

+ 15 - 0
src/gui/panels/AgendaPane.java

@@ -0,0 +1,15 @@
+package panels;
+
+import java.awt.Color;
+
+import javax.swing.JPanel;
+import javax.swing.JTable;
+import javax.swing.border.LineBorder;
+
+@SuppressWarnings("serial")
+public class AgendaPane extends JPanel {
+	public AgendaPane(){
+		this.setBorder(new LineBorder(new Color(0, 0, 0), 1, true));
+		this.add(new JTable());
+	}
+}

+ 33 - 0
src/gui/panels/InfoPane.java

@@ -0,0 +1,33 @@
+package panels;
+
+import java.awt.Color;
+import java.awt.GridLayout;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextPane;
+import javax.swing.border.LineBorder;
+
+@SuppressWarnings("serial")
+public class InfoPane extends JPanel{
+	public InfoPane(){
+		this.setLayout(new GridLayout(6,3,30,60));
+		this.setBorder(new LineBorder(new Color(0, 0, 0), 1, true));
+		label();
+		textField();
+	}
+	
+	public void label(){
+		JLabel info = new JLabel("Information");
+		this.add(info);
+		
+	}
+	
+	public void textField(){
+		JTextPane infopane = new JTextPane();
+		infopane.setEditable(false);
+		infopane.setText("aaaaaa\r\nbbbbb\r\nccccc\r\nddddd\r\n");
+		this.add(infopane);
+		
+	}
+}

+ 16 - 0
src/gui/panels/MainPanel.java

@@ -0,0 +1,16 @@
+package panels;
+
+import java.awt.BorderLayout;
+
+import javax.swing.JPanel;
+
+@SuppressWarnings("serial")
+public class MainPanel extends JPanel{
+	public MainPanel(){
+		this.setLayout(new BorderLayout());
+		this.add(new InfoPane(), BorderLayout.WEST);
+		this.add(new AgendaPane(), BorderLayout.CENTER);;
+		
+		
+	}
+}