Commit e5808d78 authored by 9731301's avatar 9731301

complete some menu action listeners for items and add image to some buttons

parent b9da4776
...@@ -2,8 +2,17 @@ ...@@ -2,8 +2,17 @@
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="f2dd20fb-7e97-49ef-9dfe-5631626d7912" name="Default Changelist" comment=""> <list default="true" id="f2dd20fb-7e97-49ef-9dfe-5631626d7912" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/src/image/1000582.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/image/1632602.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/image/535246.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$4.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$4.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$5.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$5.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$6.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$6.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$TextFieldHandler.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$TextFieldHandler.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$exitApp.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$exitApp.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI.class" afterDir="false" /> <change beforePath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Insomnia.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Insomnia.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/InsomniaGUI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/InsomniaGUI.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/InsomniaGUI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/InsomniaGUI.java" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
...@@ -36,12 +45,16 @@ ...@@ -36,12 +45,16 @@
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component> </component>
<component name="ProjectId" id="1bIsIYbvZExsc7FREkkeVEtlB9E" /> <component name="ProjectId" id="1bIsIYbvZExsc7FREkkeVEtlB9E" />
<component name="ProjectLevelVcsManager">
<ConfirmationsSetting value="2" id="Add" />
</component>
<component name="ProjectViewState"> <component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showExcludedFiles" value="true" /> <option name="showExcludedFiles" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent"> <component name="PropertiesComponent">
<property name="ASKED_ADD_EXTERNAL_FILES" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" /> <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" /> <property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" /> <property name="WebServerToolWindowFactoryState" value="false" />
...@@ -78,33 +91,37 @@ ...@@ -78,33 +91,37 @@
<workItem from="1589030581229" duration="11616000" /> <workItem from="1589030581229" duration="11616000" />
<workItem from="1589063831974" duration="14071000" /> <workItem from="1589063831974" duration="14071000" />
<workItem from="1589215032092" duration="8311000" /> <workItem from="1589215032092" duration="8311000" />
<workItem from="1589284114096" duration="16943000" />
</task> </task>
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" /> <option name="version" value="1" />
</component> </component>
<component name="VcsManagerConfiguration">
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
</component>
<component name="WindowStateProjectService"> <component name="WindowStateProjectService">
<state x="309" y="122" key="#com.intellij.ide.util.MemberChooser" timestamp="1589071976072"> <state x="309" y="122" key="#com.intellij.ide.util.MemberChooser" timestamp="1589071976072">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state x="309" y="122" key="#com.intellij.ide.util.MemberChooser/0.0.1536.824@0.0.1536.824" timestamp="1589071976072" /> <state x="309" y="122" key="#com.intellij.ide.util.MemberChooser/0.0.1536.824@0.0.1536.824" timestamp="1589071976072" />
<state width="1134" height="12" key="GridCell.Tab.0.bottom" timestamp="1589223456673"> <state width="1184" height="122" key="GridCell.Tab.0.bottom" timestamp="1589301837895">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state width="1134" height="12" key="GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824" timestamp="1589223456673" /> <state width="1184" height="122" key="GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824" timestamp="1589301837895" />
<state width="1134" height="12" key="GridCell.Tab.0.center" timestamp="1589223456673"> <state width="1184" height="122" key="GridCell.Tab.0.center" timestamp="1589301837894">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state width="1134" height="12" key="GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824" timestamp="1589223456673" /> <state width="1184" height="122" key="GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824" timestamp="1589301837894" />
<state width="1134" height="12" key="GridCell.Tab.0.left" timestamp="1589223456673"> <state width="1184" height="122" key="GridCell.Tab.0.left" timestamp="1589301837894">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state width="1134" height="12" key="GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824" timestamp="1589223456673" /> <state width="1184" height="122" key="GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824" timestamp="1589301837894" />
<state width="1134" height="12" key="GridCell.Tab.0.right" timestamp="1589223456673"> <state width="1184" height="122" key="GridCell.Tab.0.right" timestamp="1589301837895">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state width="1134" height="12" key="GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824" timestamp="1589223456673" /> <state width="1184" height="122" key="GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824" timestamp="1589301837895" />
<state x="425" y="237" key="com.intellij.ide.util.TipDialog" timestamp="1589215042759"> <state x="425" y="237" key="com.intellij.ide.util.TipDialog" timestamp="1589215042759">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
...@@ -113,9 +130,9 @@ ...@@ -113,9 +130,9 @@
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state x="163" y="189" key="run.anything.popup/0.0.1536.824@0.0.1536.824" timestamp="1589217529286" /> <state x="163" y="189" key="run.anything.popup/0.0.1536.824@0.0.1536.824" timestamp="1589217529286" />
<state x="46" y="145" width="672" height="678" key="search.everywhere.popup" timestamp="1589216473471"> <state x="46" y="145" width="672" height="678" key="search.everywhere.popup" timestamp="1589292677842">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state x="46" y="145" width="672" height="678" key="search.everywhere.popup/0.0.1536.824@0.0.1536.824" timestamp="1589216473471" /> <state x="46" y="145" width="672" height="678" key="search.everywhere.popup/0.0.1536.824@0.0.1536.824" timestamp="1589292677842" />
</component> </component>
</project> </project>
\ No newline at end of file
import java.io.IOException;
public class Insomnia { public class Insomnia {
public static void main(String [] args){ public static void main(String [] args) throws IOException {
InsomniaGUI insomniaGUI = new InsomniaGUI(); InsomniaGUI insomniaGUI = new InsomniaGUI();
} }
} }
import javafx.scene.transform.Shear; import javafx.scene.transform.Shear;
import javax.imageio.ImageIO;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.Border; import javax.swing.border.Border;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
public class InsomniaGUI { public class InsomniaGUI {
JFrame frame ; JFrame frame ;
public InsomniaGUI(){ public InsomniaGUI() throws IOException {
frame = new JFrame(); frame = new JFrame();
frame.setTitle("Insomnia"); frame.setTitle("Insomnia");
frame.setSize(900,600); frame.setSize(900,600);
...@@ -16,96 +21,12 @@ public class InsomniaGUI { ...@@ -16,96 +21,12 @@ public class InsomniaGUI {
frame.setVisible(true); frame.setVisible(true);
BufferedImage master;
master = ImageIO.read(new File("C:\\Users\\Lenovo\\IdeaProjects\\Insomnia\\src\\image\\535246.png"));
Image scaled = master.getScaledInstance(20,20, java.awt.Image.SCALE_SMOOTH);
VerticalFlowLayout vfLayout = new VerticalFlowLayout(); VerticalFlowLayout vfLayout = new VerticalFlowLayout();
Border border = BorderFactory.createLineBorder(Color.BLACK,3); Border border = BorderFactory.createLineBorder(Color.BLACK,3);
JMenuBar upperMenuBar = new JMenuBar();
JMenu application = new JMenu("Application");
JMenuItem OptionItem = new JMenuItem("Option");
OptionItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O , ActionEvent.CTRL_MASK));
JPanel optionPanel = new JPanel(new GridLayout(3,1));
JCheckBox followRedirect = new JCheckBox("follow redirect");
JCheckBox hideInSystemTray = new JCheckBox("hide in system tray");
String color []={"light theme","dark theme"};
JComboBox backGroundColor = new JComboBox(color);
backGroundColor.setFont(new Font("Arial",20,15 ));
optionPanel.add(followRedirect);
optionPanel.add(hideInSystemTray);
optionPanel.add(backGroundColor);
JFrame optionFrame= new JFrame("option");
optionFrame.setPreferredSize(new Dimension(100,100));
optionPanel.setPreferredSize(new Dimension(100,100));
optionFrame.add(optionPanel);
OptionItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
optionFrame.setVisible(true);
}
});
JMenuItem exitItem = new JMenuItem("Exit ");
exitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T,ActionEvent.ALT_MASK));
exitItem.addActionListener(new exitApp());
application.add(OptionItem);
application.add(exitItem);
JMenu edit = new JMenu("Edit");
edit.setMnemonic('e');
JMenu view = new JMenu("View");
view.setMnemonic('v');
JMenuItem ToggleFullScreen = new JMenuItem("Toggle Full Screen");
ToggleFullScreen.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T , KeyEvent.VK_F));
JMenuItem ToggleSidebar = new JMenuItem("Toggle Sidebar");
ToggleSidebar.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_L ,KeyEvent.VK_S ));
view.add(ToggleFullScreen);
view.add(ToggleSidebar);
JMenu window = new JMenu("Tools");
window.setMnemonic('w');
JMenuItem minimize = new JMenuItem("Minimize");
window.add(minimize);
JMenu help = new JMenu("Help");
help.setMnemonic('h');
JMenuItem aboutItem = new JMenuItem("About");
aboutItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A , ActionEvent.CTRL_MASK));
aboutItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JPanel aboutPanel = new JPanel();
JTextArea aboutText = new JTextArea();
aboutText.setEditable(false);
aboutText.setText("developer\tzahra seyedFatehi \nEmail \ts.fatehi1378@Gmail.com\nstudent number\t9731301");
aboutPanel.add(aboutText);
aboutText.setPreferredSize(new Dimension(300,200));
JFrame frame = new JFrame("About");
frame.setLocation(100,100);
frame.setPreferredSize(new Dimension(200,200));
frame.add(aboutPanel);
frame.setVisible(true);
}
});
help.add( aboutItem);
JMenuItem helpItem= new JMenuItem("help");
helpItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_H , ActionEvent.CTRL_MASK));
helpItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JPanel helpPanel = new JPanel();
JTextArea helpText = new JTextArea();
helpPanel.add(helpText);
frame.setLocation(100,100);
frame.setPreferredSize(new Dimension(200,200));
frame.add(helpPanel);
frame.setVisible(true);
}
});
help.add(helpItem);
upperMenuBar.add(application);
upperMenuBar.add(edit);
upperMenuBar.add(view);
upperMenuBar.add(window);
upperMenuBar.add(help);
JPanel body = new JPanel(); JPanel body = new JPanel();
body.setBackground(Color.GRAY); body.setBackground(Color.GRAY);
...@@ -138,8 +59,9 @@ public class InsomniaGUI { ...@@ -138,8 +59,9 @@ public class InsomniaGUI {
JTextField newValueField = new JTextField("value"); JTextField newValueField = new JTextField("value");
newValueField.setBorder(border); newValueField.setBorder(border);
JCheckBox newCheckBox = new JCheckBox(); JCheckBox newCheckBox = new JCheckBox();
ImageIcon newQuitIcon = new ImageIcon(); JButton newDelete = new JButton();
JButton newDelete = new JButton(newQuitIcon); newDelete.setPreferredSize(new Dimension(20,20));
newDelete.setIcon(new ImageIcon(scaled));
JPanel newRightOfHeader = new JPanel(); JPanel newRightOfHeader = new JPanel();
newRightOfHeader.add(newCheckBox); newRightOfHeader.add(newCheckBox);
newRightOfHeader.add(newDelete); newRightOfHeader.add(newDelete);
...@@ -180,8 +102,9 @@ public class InsomniaGUI { ...@@ -180,8 +102,9 @@ public class InsomniaGUI {
JTextField valueField = new JTextField("value"); JTextField valueField = new JTextField("value");
valueField.setBorder(border); valueField.setBorder(border);
JCheckBox checkBox = new JCheckBox(); JCheckBox checkBox = new JCheckBox();
ImageIcon quitIcon = new ImageIcon(); JButton delete = new JButton();
JButton delete = new JButton(quitIcon); delete.setIcon(new ImageIcon(scaled));
delete.setPreferredSize(new Dimension(20,20));
JPanel rightOfHeader = new JPanel(); JPanel rightOfHeader = new JPanel();
rightOfHeader.add(checkBox); rightOfHeader.add(checkBox);
rightOfHeader.add(delete); rightOfHeader.add(delete);
...@@ -216,6 +139,9 @@ public class InsomniaGUI { ...@@ -216,6 +139,9 @@ public class InsomniaGUI {
//respond //respond
JPanel row = new JPanel(); JPanel row = new JPanel();
JTextArea massageBody = new JTextArea();
massageBody.setPreferredSize(new Dimension(200,300));
row.add(massageBody);
row.setBackground(Color.GRAY); row.setBackground(Color.GRAY);
JPanel mainCenterHeader_respond = new JPanel(vfLayout); JPanel mainCenterHeader_respond = new JPanel(vfLayout);
JScrollPane scrollPane_Header_Request2 = new JScrollPane(mainCenterHeader_respond); JScrollPane scrollPane_Header_Request2 = new JScrollPane(mainCenterHeader_respond);
...@@ -312,6 +238,7 @@ public class InsomniaGUI { ...@@ -312,6 +238,7 @@ public class InsomniaGUI {
panelRight.add(request); panelRight.add(request);
panelRight.add(response); panelRight.add(response);
JMenu menu = new JMenu("Insomnia"); JMenu menu = new JMenu("Insomnia");
menu.setFont(new Font("Arial",20,15 )); menu.setFont(new Font("Arial",20,15 ));
menu.setBorder(border); menu.setBorder(border);
...@@ -320,7 +247,9 @@ public class InsomniaGUI { ...@@ -320,7 +247,9 @@ public class InsomniaGUI {
JPanel up_left = new JPanel(new GridLayout(2,1)); JPanel up_left = new JPanel(new GridLayout(2,1));
up_left.add(menu); up_left.add(menu);
up_left.add(addRequest); up_left.add(addRequest);
up_left.setBackground(Color.GRAY);
JPanel requestList = new JPanel(vfLayout); JPanel requestList = new JPanel(vfLayout);
requestList.setBackground(Color.GRAY);
JScrollPane scrollRequests = new JScrollPane(requestList); JScrollPane scrollRequests = new JScrollPane(requestList);
addRequest.addMouseListener(new MouseListener() { addRequest.addMouseListener(new MouseListener() {
@Override @Override
...@@ -330,10 +259,8 @@ public class InsomniaGUI { ...@@ -330,10 +259,8 @@ public class InsomniaGUI {
requestList.add(jLabel); requestList.add(jLabel);
i++; i++;
} }
@Override @Override
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {
} }
@Override @Override
...@@ -351,11 +278,170 @@ public class InsomniaGUI { ...@@ -351,11 +278,170 @@ public class InsomniaGUI {
} }
}); });
//left panel (list of requests)
JPanel panelLeft = new JPanel(new BorderLayout()); JPanel panelLeft = new JPanel(new BorderLayout());
panelLeft.setBackground(Color.GRAY);
panelLeft.add(up_left , BorderLayout.NORTH); panelLeft.add(up_left , BorderLayout.NORTH);
panelLeft.add(scrollRequests, BorderLayout.CENTER); panelLeft.add(scrollRequests, BorderLayout.CENTER);
panelLeft.setBackground(Color.LIGHT_GRAY); panelLeft.setBackground(Color.LIGHT_GRAY);
//menu upper_Items
JMenuBar upperMenuBar = new JMenuBar();
JMenu application = new JMenu("Application");
JMenuItem OptionItem = new JMenuItem("Option");
OptionItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O , ActionEvent.CTRL_MASK));
JPanel optionPanel = new JPanel(new GridLayout(3,1));
JCheckBox followRedirect = new JCheckBox("follow redirect");
JCheckBox hideInSystemTray = new JCheckBox("hide in system tray");
String color []={"light theme","dark theme"};
JComboBox backGroundColor = new JComboBox(color);
backGroundColor.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String s = (String) backGroundColor.getSelectedItem();//get the selected item
switch (s) {//check for a match
case "light theme":{
body.setBackground(Color.WHITE);
auth.setBackground(Color.WHITE);
query.setBackground(Color.WHITE);
mainCenterHeader.setBackground(Color.WHITE);
docs.setBackground(Color.WHITE);
row.setBackground(Color.WHITE);
mainCenterHeader_respond.setBackground(Color.WHITE);
header.setBackground(Color.WHITE);
header2.setBackground(Color.WHITE);
header_MainPanel.setBackground(Color.WHITE);
timeline.setBackground(Color.WHITE);
cookie.setBackground(Color.WHITE);
panelRight.setBackground(Color.WHITE);
up_left.setBackground(Color.WHITE);
requestList.setBackground(Color.WHITE);
break;
}
case "dark theme":{
body.setBackground(Color.DARK_GRAY);
auth.setBackground(Color.DARK_GRAY);
query.setBackground(Color.DARK_GRAY);
mainCenterHeader.setBackground(Color.DARK_GRAY);
docs.setBackground(Color.DARK_GRAY);
row.setBackground(Color.DARK_GRAY);
mainCenterHeader_respond.setBackground(Color.DARK_GRAY);
header.setBackground(Color.DARK_GRAY);
header2.setBackground(Color.DARK_GRAY);
header_MainPanel.setBackground(Color.DARK_GRAY);
timeline.setBackground(Color.DARK_GRAY);
cookie.setBackground(Color.DARK_GRAY);
up_left.setBackground(Color.DARK_GRAY);
requestList.setBackground(Color.DARK_GRAY);
}
}
}
});
backGroundColor.setFont(new Font("Arial",20,15 ));
optionPanel.add(followRedirect);
optionPanel.add(hideInSystemTray);
optionPanel.add(backGroundColor);
JFrame optionFrame= new JFrame("option");
optionFrame.setPreferredSize(new Dimension(100,100));
optionPanel.setPreferredSize(new Dimension(100,100));
optionFrame.add(optionPanel);
OptionItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
optionFrame.setVisible(true);
}
});
JMenuItem exitItem = new JMenuItem("Exit ");
exitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T,ActionEvent.ALT_MASK));
exitItem.addActionListener(new exitApp());
application.add(OptionItem);
application.add(exitItem);
JMenu edit = new JMenu("Edit");
edit.setMnemonic('E');
JMenu view = new JMenu("View");
view.setMnemonic('V');
JMenuItem ToggleFullScreen = new JMenuItem("Toggle Full Screen");
ToggleFullScreen.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T , KeyEvent.VK_F));
ToggleFullScreen.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (frame.getExtendedState() == JFrame.MAXIMIZED_BOTH){
frame.setExtendedState(JFrame.NORMAL);
}
else {
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
}
}
});
JMenuItem ToggleSidebar = new JMenuItem("Toggle Sidebar");
ToggleSidebar.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (panelLeft.isVisible() == true) {
panelLeft.setVisible(false);
}
else {
panelLeft.setVisible(true);
}
}
});
ToggleSidebar.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_L ,KeyEvent.VK_S ));
view.add(ToggleFullScreen);
view.add(ToggleSidebar);
JMenu window = new JMenu("Tools");
window.setMnemonic('W');
JMenuItem minimize = new JMenuItem("Minimize");
window.add(minimize);
JMenu help = new JMenu("Help");
help.setMnemonic('H');
JMenuItem aboutItem = new JMenuItem("About");
aboutItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A , ActionEvent.CTRL_MASK));
aboutItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JPanel aboutPanel = new JPanel();
JTextArea aboutText = new JTextArea();
aboutText.setEditable(false);
aboutText.setText("developer\tzahra seyedFatehi \nEmail \ts.fatehi1378@Gmail.com\nstudent number\t9731301");
aboutPanel.add(aboutText);
aboutText.setPreferredSize(new Dimension(300,200));
JFrame frame = new JFrame("About");
frame.setLocation(100,100);
frame.setPreferredSize(new Dimension(200,200));
frame.add(aboutPanel);
frame.setVisible(true);
}
});
help.add( aboutItem);
JMenuItem helpItem= new JMenuItem("help");
helpItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_H , ActionEvent.CTRL_MASK));
helpItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JPanel helpPanel = new JPanel();
JTextArea helpText = new JTextArea();
helpPanel.add(helpText);
frame.setLocation(100,100);
frame.setPreferredSize(new Dimension(200,200));
frame.add(helpPanel);
frame.setVisible(true);
}
});
help.add(helpItem);
upperMenuBar.add(application);
upperMenuBar.add(edit);
upperMenuBar.add(view);
upperMenuBar.add(window);
upperMenuBar.add(help);
upperMenuBar.setFocusable(true);
JPanel panel = new JPanel(new BorderLayout()); JPanel panel = new JPanel(new BorderLayout());
panel.add(upperMenuBar , BorderLayout.NORTH); panel.add(upperMenuBar , BorderLayout.NORTH);
panel.add(panelLeft , BorderLayout.WEST); panel.add(panelLeft , BorderLayout.WEST);
...@@ -382,8 +468,7 @@ public class InsomniaGUI { ...@@ -382,8 +468,7 @@ public class InsomniaGUI {
JTextField newValueField = new JTextField("value"); JTextField newValueField = new JTextField("value");
newValueField.setBorder(border); newValueField.setBorder(border);
JCheckBox newCheckBox = new JCheckBox(); JCheckBox newCheckBox = new JCheckBox();
ImageIcon newQuitIcon = new ImageIcon(); JButton newDelete = new JButton(new ImageIcon("C:\\Users\\Lenovo\\IdeaProjects\\Insomnia\\src\\image\\1000582.png"));
JButton newDelete = new JButton(newQuitIcon);
JPanel newRightOfHeader = new JPanel(); JPanel newRightOfHeader = new JPanel();
newRightOfHeader.add(newCheckBox); newRightOfHeader.add(newCheckBox);
newRightOfHeader.add(newDelete); newRightOfHeader.add(newDelete);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment