Commit 557c0d2d authored by 9731301's avatar 9731301

change the gui type and sperate one class to 3 more classes

parent ece9abad
...@@ -2,73 +2,35 @@ ...@@ -2,73 +2,35 @@
<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$/javaDoc/Insomnia.html" afterDir="false" /> <change afterPath="$PROJECT_DIR$/out/production/Insomnia/LeftPanel$1.class" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/InsomniaGUI.html" afterDir="false" /> <change afterPath="$PROJECT_DIR$/out/production/Insomnia/LeftPanel.class" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/allclasses-frame.html" afterDir="false" /> <change afterPath="$PROJECT_DIR$/out/production/Insomnia/META-INF/Insomnia.kotlin_module" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/allclasses-noframe.html" afterDir="false" /> <change afterPath="$PROJECT_DIR$/out/production/Insomnia/RequestPanel$1.class" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/constant-values.html" afterDir="false" /> <change afterPath="$PROJECT_DIR$/out/production/Insomnia/RequestPanel$TextFieldHandler.class" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/deprecated-list.html" afterDir="false" /> <change afterPath="$PROJECT_DIR$/out/production/Insomnia/RequestPanel.class" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/element-list" afterDir="false" /> <change afterPath="$PROJECT_DIR$/out/production/Insomnia/RespondPanel$1.class" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/help-doc.html" afterDir="false" /> <change afterPath="$PROJECT_DIR$/out/production/Insomnia/RespondPanel.class" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/index-files/index-1.html" afterDir="false" /> <change afterPath="$PROJECT_DIR$/src/LeftPanel.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/index-files/index-2.html" afterDir="false" /> <change afterPath="$PROJECT_DIR$/src/RequestPanel.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/index.html" afterDir="false" /> <change afterPath="$PROJECT_DIR$/src/RespondPanel.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/jquery/external/jquery/jquery.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/jquery/images/ui-bg_flat_0_aaaaaa_40x100.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/jquery/images/ui-bg_flat_75_ffffff_40x100.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/jquery/images/ui-bg_glass_55_fbf9ee_1x400.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/jquery/images/ui-bg_glass_65_ffffff_1x400.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/jquery/images/ui-bg_glass_75_dadada_1x400.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/jquery/images/ui-bg_glass_75_e6e6e6_1x400.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/jquery/images/ui-bg_glass_95_fef1ec_1x400.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/jquery/images/ui-bg_highlight-soft_75_cccccc_1x100.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/jquery/images/ui-icons_222222_256x240.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/jquery/images/ui-icons_2e83ff_256x240.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/jquery/images/ui-icons_454545_256x240.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/jquery/images/ui-icons_888888_256x240.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/jquery/images/ui-icons_cd0a0a_256x240.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/jquery/jquery-1.10.2.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/jquery/jquery-ui.css" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/jquery/jquery-ui.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/jquery/jquery-ui.min.css" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/jquery/jquery-ui.min.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/jquery/jquery-ui.structure.css" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/jquery/jquery-ui.structure.min.css" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/jquery/jszip-utils/dist/jszip-utils-ie.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/jquery/jszip-utils/dist/jszip-utils-ie.min.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/jquery/jszip-utils/dist/jszip-utils.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/jquery/jszip-utils/dist/jszip-utils.min.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/jquery/jszip/dist/jszip.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/jquery/jszip/dist/jszip.min.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/member-search-index.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/member-search-index.zip" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/overview-tree.html" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/package-frame.html" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/package-summary.html" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/package-tree.html" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/resources/glass.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/resources/x.png" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/script.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/search.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/stylesheet.css" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/type-search-index.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/javaDoc/type-search-index.zip" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" 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/Insomnia.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/Insomnia.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$1.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$1.class" afterDir="false" /> <change beforePath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$1.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$1.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$2.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$2.class" afterDir="false" /> <change beforePath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$2.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$2.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$3.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$3.class" afterDir="false" /> <change beforePath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$3.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$3.class" 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$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$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$6.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$6.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$7.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$7.class" afterDir="false" /> <change beforePath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$7.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$8.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$8.class" afterDir="false" /> <change beforePath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$8.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$9.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$9.class" afterDir="false" /> <change beforePath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$9.class" beforeDir="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$TextFieldHandler.class" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$exitApp$1.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$exitApp$1.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$exitApp$2.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/InsomniaGUI$exitApp$2.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$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" />
<change beforePath="$PROJECT_DIR$/src/VerticalFlowLayout.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/VerticalFlowLayout.java" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
...@@ -149,7 +111,7 @@ ...@@ -149,7 +111,7 @@
<workItem from="1589284114096" duration="17862000" /> <workItem from="1589284114096" duration="17862000" />
<workItem from="1589307905083" duration="2368000" /> <workItem from="1589307905083" duration="2368000" />
<workItem from="1590134960872" duration="204000" /> <workItem from="1590134960872" duration="204000" />
<workItem from="1590135200352" duration="243000" /> <workItem from="1590135200352" duration="13410000" />
</task> </task>
<servers /> <servers />
</component> </component>
...@@ -160,10 +122,14 @@ ...@@ -160,10 +122,14 @@
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" /> <option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
</component> </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="1590148652521">
<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="1590148652521" />
<state x="499" y="160" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog" timestamp="1590137018534">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="499" y="160" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog/0.0.1536.824@0.0.1536.824" timestamp="1590137018534" />
<state x="369" y="145" key="ANALYSIS_DLG_com.intellij.analysis.BaseAnalysisAction$1" timestamp="1589304315504"> <state x="369" y="145" key="ANALYSIS_DLG_com.intellij.analysis.BaseAnalysisAction$1" timestamp="1589304315504">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
...@@ -172,26 +138,30 @@ ...@@ -172,26 +138,30 @@
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state x="402" y="167" key="FileChooserDialogImpl/0.0.1536.824@0.0.1536.824" timestamp="1590135150404" /> <state x="402" y="167" key="FileChooserDialogImpl/0.0.1536.824@0.0.1536.824" timestamp="1590135150404" />
<state width="1185" height="109" key="GridCell.Tab.0.bottom" timestamp="1589310293856"> <state width="1493" height="110" key="GridCell.Tab.0.bottom" timestamp="1590148907434">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state width="1185" height="109" key="GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824" timestamp="1589310293856" /> <state width="1493" height="110" key="GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824" timestamp="1590148907434" />
<state width="1185" height="109" key="GridCell.Tab.0.center" timestamp="1589310293856"> <state width="1493" height="110" key="GridCell.Tab.0.center" timestamp="1590148907434">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state width="1185" height="109" key="GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824" timestamp="1589310293856" /> <state width="1493" height="110" key="GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824" timestamp="1590148907434" />
<state width="1185" height="109" key="GridCell.Tab.0.left" timestamp="1589310293856"> <state width="1493" height="110" key="GridCell.Tab.0.left" timestamp="1590148907433">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state width="1185" height="109" key="GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824" timestamp="1589310293856" /> <state width="1493" height="110" key="GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824" timestamp="1590148907433" />
<state width="1185" height="109" key="GridCell.Tab.0.right" timestamp="1589310293856"> <state width="1493" height="110" key="GridCell.Tab.0.right" timestamp="1590148907434">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state width="1185" height="109" key="GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824" timestamp="1589310293856" /> <state width="1493" height="110" key="GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824" timestamp="1590148907434" />
<state x="425" y="237" key="com.intellij.ide.util.TipDialog" timestamp="1590134962655"> <state x="425" y="237" key="com.intellij.ide.util.TipDialog" timestamp="1590134962655">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state x="425" y="237" key="com.intellij.ide.util.TipDialog/0.0.1536.824@0.0.1536.824" timestamp="1590134962655" /> <state x="425" y="237" key="com.intellij.ide.util.TipDialog/0.0.1536.824@0.0.1536.824" timestamp="1590134962655" />
<state x="499" y="179" key="extract.method.dialog" timestamp="1590145349556">
<screen x="0" y="0" width="1536" height="824" />
</state>
<state x="499" y="179" key="extract.method.dialog/0.0.1536.824@0.0.1536.824" timestamp="1590145349556" />
<state x="163" y="189" key="run.anything.popup" timestamp="1589217529286"> <state x="163" y="189" key="run.anything.popup" timestamp="1589217529286">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
......
import java.awt.*;
import java.io.IOException; import java.io.IOException;
public class Insomnia { public class Insomnia {
public static void main(String [] args) throws IOException { public static void main(String [] args) throws IOException {
InsomniaGUI insomniaGUI = new InsomniaGUI(); InsomniaGUI insomniaGUI = new InsomniaGUI();
Frame frame = new Frame();
} }
} }
...@@ -4,13 +4,10 @@ ...@@ -4,13 +4,10 @@
* @version 0.0 * @version 0.0
*/ */
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; import java.io.IOException;
import static com.sun.glass.ui.Cursor.setVisible; import static com.sun.glass.ui.Cursor.setVisible;
...@@ -27,272 +24,19 @@ public class InsomniaGUI { ...@@ -27,272 +24,19 @@ public class InsomniaGUI {
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true); frame.setVisible(true);
RequestPanel request = new RequestPanel();
BufferedImage master; request.createRequestPanel();
master = ImageIO.read(new File("C:\\Users\\Lenovo\\IdeaProjects\\Insomnia\\src\\image\\535246.png")); RespondPanel response = new RespondPanel();
Image scaled = master.getScaledInstance(20,20, java.awt.Image.SCALE_SMOOTH); response.createRespondPanel();
VerticalFlowLayout vfLayout = new VerticalFlowLayout();
Border border = BorderFactory.createLineBorder(Color.BLACK,3);
JPanel body = new JPanel();
body.setBackground(Color.GRAY);
JPanel auth = new JPanel();
auth.setBackground(Color.GRAY);
JPanel query = new JPanel();
query.setBackground(Color.GRAY);
JPanel mainCenterHeader = new JPanel(vfLayout);
mainCenterHeader.setBackground(Color.GRAY);
JScrollPane scrollPane_Header_Request = new JScrollPane(mainCenterHeader);
scrollPane_Header_Request.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
JPanel docs = new JPanel();
docs.setBackground(Color.GRAY);
//request-center
JTabbedPane tabbedPaneCenterRequest = new JTabbedPane();
tabbedPaneCenterRequest.setBackground(Color.GRAY);
tabbedPaneCenterRequest.add("Body" , body);
tabbedPaneCenterRequest.add("Auth" , auth);
tabbedPaneCenterRequest.add("Query" , query);
tabbedPaneCenterRequest.add("Header" , scrollPane_Header_Request);
tabbedPaneCenterRequest.add("Docs" , docs);
JTextField headerField = new JTextField("header");
headerField.addMouseListener(new MouseListener() {
@Override
public void mouseClicked(MouseEvent e) {
JTextField newHeaderField = new JTextField("header");
newHeaderField.setBorder(border);
JTextField newValueField = new JTextField("value");
newValueField.setBorder(border);
JCheckBox newCheckBox = new JCheckBox();
JButton newDelete = new JButton();
newDelete.setPreferredSize(new Dimension(20,20));
newDelete.setIcon(new ImageIcon(scaled));
JPanel newRightOfHeader = new JPanel();
newRightOfHeader.add(newCheckBox);
newRightOfHeader.add(newDelete);
JPanel new_center_header = new JPanel(new GridLayout(1, 2));
new_center_header.add(newHeaderField);
new_center_header.add(newValueField);
JPanel newHeader = new JPanel(new BorderLayout());
newHeader.add(newRightOfHeader, BorderLayout.EAST);
newHeader.add(new_center_header, BorderLayout.CENTER);
mainCenterHeader.add(newHeader );
}
@Override
public void mousePressed(MouseEvent e) {
}
@Override
public void mouseReleased(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
});
TextFieldHandler textFieldHandler = new TextFieldHandler(headerField,mainCenterHeader,border);//create a actionListener
headerField.setFocusable(true);
headerField.addActionListener( textFieldHandler);
headerField.setBorder(border);
JTextField valueField = new JTextField("value");
valueField.setBorder(border);
JCheckBox checkBox = new JCheckBox();
JButton delete = new JButton();
delete.setIcon(new ImageIcon(scaled));
delete.setPreferredSize(new Dimension(20,20));
JPanel rightOfHeader = new JPanel();
rightOfHeader.add(checkBox);
rightOfHeader.add(delete);
JPanel center_header = new JPanel(new GridLayout(1,2));
center_header.add(headerField);
center_header.add(valueField);
JPanel header = new JPanel(new BorderLayout());
header.add(rightOfHeader,BorderLayout.EAST);
header.add(center_header,BorderLayout.CENTER);
mainCenterHeader.add(header);
//request_up
String s []={"Patch","Put","Post","Delete","Get"};
JComboBox centerMenu = new JComboBox(s);
centerMenu.setFont(new Font("Arial",20,15 ));
JTextField URLTextField = new JTextField("http://api.myproduct.com/v1/users");
JButton sendButton = new JButton("send");
JPanel centerUp = new JPanel(new BorderLayout());
centerUp.add(centerMenu , BorderLayout.WEST);
centerUp.add(URLTextField , BorderLayout.CENTER);
centerUp.add(sendButton , BorderLayout.EAST);
JPanel request = new JPanel(new BorderLayout());
request.add(centerUp,BorderLayout.NORTH);
request.add(tabbedPaneCenterRequest , BorderLayout.CENTER);
//respond
JPanel row = new JPanel();
JTextArea massageBody = new JTextArea();
massageBody.setPreferredSize(new Dimension(200,300));
row.add(massageBody);
row.setBackground(Color.GRAY);
JPanel mainCenterHeader_respond = new JPanel(vfLayout);
JScrollPane scrollPane_Header_Request2 = new JScrollPane(mainCenterHeader_respond);
scrollPane_Header_Request.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
mainCenterHeader_respond.setBackground(Color.GRAY);
JPanel header_MainPanel = new JPanel(new BorderLayout());
header_MainPanel.setBackground(Color.GRAY);
JButton copyToClipBoard = new JButton("copy to clip board");
header_MainPanel.add(scrollPane_Header_Request2 , BorderLayout.CENTER);
header_MainPanel.add(copyToClipBoard,BorderLayout.SOUTH);
JPanel cookie = new JPanel();
cookie.setBackground(Color.GRAY);
JPanel timeline = new JPanel(new BorderLayout());
timeline.setBackground(Color.GRAY);
JTabbedPane tabbedPaneCenterResponse = new JTabbedPane();
tabbedPaneCenterResponse.setBackground(Color.GRAY);
tabbedPaneCenterResponse.add("Row" , row);
tabbedPaneCenterResponse.add("Header" , header_MainPanel);
tabbedPaneCenterResponse.add("Cookie", cookie);
tabbedPaneCenterResponse.add("Timeline" , timeline);
JPanel response = new JPanel(new BorderLayout());
JTextField headerField2 = new JTextField("header");
headerField2.setEditable(false);
headerField2.addMouseListener(new MouseListener() {
@Override
public void mouseClicked(MouseEvent e) {
System.out.println(")))))))))))");
// if (!headerField2.getText().equals("") ) {
JTextField newHeaderField = new JTextField("header");
newHeaderField.setEditable(false);
newHeaderField.setBorder(border);
JTextField newValueField = new JTextField("value");
newValueField.setEditable(false);
newValueField.setBorder(border);
JPanel new_center_header = new JPanel(new GridLayout(1, 2));
new_center_header.add(newHeaderField);
new_center_header.add(newValueField);
JPanel newHeader = new JPanel(new BorderLayout());
newHeader.add(new_center_header, BorderLayout.CENTER);
mainCenterHeader_respond.add(newHeader );
// }
}
@Override
public void mousePressed(MouseEvent e) {
}
@Override
public void mouseReleased(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
});
headerField2.setBorder(border);
JTextField valueField2 = new JTextField("value");
valueField2.setEditable(false);
valueField2.setBorder(border);
JPanel center_header2 = new JPanel(new GridLayout(1,2));
center_header2.add(headerField2);
center_header2.add(valueField2);
JPanel header2 = new JPanel(new BorderLayout());
header2.add(center_header2,BorderLayout.CENTER);
mainCenterHeader_respond.add(header2);
JPanel up_response = new JPanel();
JLabel label1 = new JLabel("ok");
label1.setBorder(border);
JLabel label2 = new JLabel("s");
label2.setBorder(border);
JLabel label3 = new JLabel("KB");
label3.setBorder(border);
up_response.add(label1);
up_response.add(label2);
up_response.add(label3);
response.add(tabbedPaneCenterResponse , BorderLayout.CENTER);
response.add(up_response,BorderLayout.NORTH);
JPanel panelRight = new JPanel(new GridLayout(1 ,2 )); JPanel panelRight = new JPanel(new GridLayout(1 ,2 ));
panelRight.add(request); panelRight.add(request);
panelRight.add(response); panelRight.add(response);
LeftPanel leftPanel = new LeftPanel();
leftPanel.createLeftPanel();
JMenu menu = new JMenu("Insomnia");
menu.setFont(new Font("Arial",20,15 ));
menu.setBorder(border);
menu.setPreferredSize(new Dimension(200,60));
JButton addRequest = new JButton("Add Request");
JPanel up_left = new JPanel(new GridLayout(2,1));
up_left.add(menu);
up_left.add(addRequest);
up_left.setBackground(Color.GRAY);
JPanel requestList = new JPanel(vfLayout);
requestList.setBackground(Color.GRAY);
JScrollPane scrollRequests = new JScrollPane(requestList);
addRequest.addMouseListener(new MouseListener() {
@Override
public void mouseClicked(MouseEvent e) {
int i = 1;
JLabel jLabel= new JLabel("request"+i);
requestList.add(jLabel);
i++;
}
@Override
public void mousePressed(MouseEvent e) {
}
@Override
public void mouseReleased(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
});
//left panel (list of requests)
JPanel panelLeft = new JPanel(new BorderLayout());
panelLeft.setBackground(Color.GRAY);
panelLeft.add(up_left , BorderLayout.NORTH);
panelLeft.add(scrollRequests, BorderLayout.CENTER);
panelLeft.setBackground(Color.LIGHT_GRAY);
//menu upper_Items //menu upper_Items
JMenuBar upperMenuBar = new JMenuBar(); JMenuBar upperMenuBar = new JMenuBar();
...@@ -311,38 +55,67 @@ public class InsomniaGUI { ...@@ -311,38 +55,67 @@ public class InsomniaGUI {
switch (s) {//check for a match switch (s) {//check for a match
case "light theme":{ case "light theme":{
body.setBackground(Color.WHITE); response.getCookie().setBackground(Color.WHITE);
auth.setBackground(Color.WHITE); response.getCopyToClipBoard().setBackground(Color.WHITE);
query.setBackground(Color.WHITE); response.getHeader_MainPanel().setBackground(Color.WHITE);
mainCenterHeader.setBackground(Color.WHITE); response.getHeaderField2().setBackground(Color.WHITE);
docs.setBackground(Color.WHITE); response.getMainCenterHeader_respond().setBackground(Color.WHITE);
row.setBackground(Color.WHITE); response.getMassageBody().setBackground(Color.WHITE);
mainCenterHeader_respond.setBackground(Color.WHITE); response.getScrollPane_Header_Respond().setBackground(Color.WHITE);
header.setBackground(Color.WHITE); response.getTabbedPaneCenterResponse().setBackground(Color.WHITE);
header2.setBackground(Color.WHITE); response.getTimeline().setBackground(Color.WHITE);
header_MainPanel.setBackground(Color.WHITE); response.getRow().setBackground(Color.WHITE);
timeline.setBackground(Color.WHITE); request.getRootPane().setBackground(Color.WHITE);
cookie.setBackground(Color.WHITE); request.getAuth().setBackground(Color.WHITE);
panelRight.setBackground(Color.WHITE); request.getBody().setBackground(Color.WHITE);
up_left.setBackground(Color.WHITE); request.getCenter_header().setBackground(Color.WHITE);
requestList.setBackground(Color.WHITE); request.getDocs().setBackground(Color.WHITE);
request.getCenterMenu().setBackground(Color.WHITE);
request.getCenterUp().setBackground(Color.WHITE);
request.getHeader().setBackground(Color.WHITE);
request.getRightOfHeader().setBackground(Color.WHITE);
request.getMainCenterHeader().setBackground(Color.WHITE);
request.getScrollPane_Header_Request().setBackground(Color.WHITE);
request.getTabbedPaneCenterRequest().setBackground(Color.WHITE);
request.getQuery().setBackground(Color.WHITE);
leftPanel.getAddRequest().setBackground(Color.WHITE);
leftPanel.getMenu().setBackground(Color.WHITE);
leftPanel.getScrollRequests().setBackground(Color.WHITE);
leftPanel.getRequestList().setBackground(Color.WHITE);
leftPanel.getUp_left().setBackground(Color.WHITE);
leftPanel.getAddRequest().setBackground(Color.WHITE);
break; break;
} }
case "dark theme":{ case "dark theme":{
body.setBackground(Color.DARK_GRAY); response.getCookie().setBackground(Color.DARK_GRAY);
auth.setBackground(Color.DARK_GRAY); response.getCopyToClipBoard().setBackground(Color.DARK_GRAY);
query.setBackground(Color.DARK_GRAY); response.getHeader_MainPanel().setBackground(Color.DARK_GRAY);
mainCenterHeader.setBackground(Color.DARK_GRAY); response.getHeaderField2().setBackground(Color.DARK_GRAY);
docs.setBackground(Color.DARK_GRAY); response.getMainCenterHeader_respond().setBackground(Color.DARK_GRAY);
row.setBackground(Color.DARK_GRAY); response.getMassageBody().setBackground(Color.DARK_GRAY);
mainCenterHeader_respond.setBackground(Color.DARK_GRAY); response.getScrollPane_Header_Respond().setBackground(Color.DARK_GRAY);
header.setBackground(Color.DARK_GRAY); response.getTabbedPaneCenterResponse().setBackground(Color.DARK_GRAY);
header2.setBackground(Color.DARK_GRAY); response.getTimeline().setBackground(Color.DARK_GRAY);
header_MainPanel.setBackground(Color.DARK_GRAY); response.getRow().setBackground(Color.DARK_GRAY);
timeline.setBackground(Color.DARK_GRAY); request.getRootPane().setBackground(Color.DARK_GRAY);
cookie.setBackground(Color.DARK_GRAY); request.getAuth().setBackground(Color.DARK_GRAY);
up_left.setBackground(Color.DARK_GRAY); request.getBody().setBackground(Color.DARK_GRAY);
requestList.setBackground(Color.DARK_GRAY); request.getCenter_header().setBackground(Color.DARK_GRAY);
request.getDocs().setBackground(Color.DARK_GRAY);
request.getCenterMenu().setBackground(Color.DARK_GRAY);
request.getCenterUp().setBackground(Color.DARK_GRAY);
request.getHeader().setBackground(Color.DARK_GRAY);
request.getRightOfHeader().setBackground(Color.DARK_GRAY);
request.getMainCenterHeader().setBackground(Color.DARK_GRAY);
request.getScrollPane_Header_Request().setBackground(Color.DARK_GRAY);
request.getTabbedPaneCenterRequest().setBackground(Color.DARK_GRAY);
request.getQuery().setBackground(Color.DARK_GRAY);
leftPanel.getAddRequest().setBackground(Color.DARK_GRAY);
leftPanel.getMenu().setBackground(Color.DARK_GRAY);
leftPanel.getScrollRequests().setBackground(Color.DARK_GRAY);
leftPanel.getRequestList().setBackground(Color.DARK_GRAY);
leftPanel.getUp_left().setBackground(Color.DARK_GRAY);
leftPanel.getAddRequest().setBackground(Color.DARK_GRAY);
} }
} }
} }
...@@ -389,11 +162,11 @@ public class InsomniaGUI { ...@@ -389,11 +162,11 @@ public class InsomniaGUI {
ToggleSidebar.addActionListener(new ActionListener() { ToggleSidebar.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (panelLeft.isVisible() == true) { if (leftPanel.isVisible() == true) {
panelLeft.setVisible(false); leftPanel.setVisible(false);
} }
else { else {
panelLeft.setVisible(true); leftPanel.setVisible(true);
} }
} }
}); });
...@@ -451,44 +224,13 @@ public class InsomniaGUI { ...@@ -451,44 +224,13 @@ public class InsomniaGUI {
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(leftPanel , BorderLayout.WEST);
panel.add(panelRight , BorderLayout.CENTER); panel.add(panelRight , BorderLayout.CENTER);
frame.getContentPane().add(panel); frame.getContentPane().add(panel);
} }
private class TextFieldHandler implements ActionListener{
JTextField headerField ;
JPanel mainCenterHeader;
Border border;
private TextFieldHandler(JTextField headerField , JPanel mainCenterHeader , Border border){
this.headerField = headerField;
this.mainCenterHeader = mainCenterHeader;
this.border = border;
}
@Override
public void actionPerformed(ActionEvent e) {
System.out.println("++++++++++++");
if (!headerField.getText().equals("") ) {
JTextField newHeaderField = new JTextField("header");
newHeaderField.setBorder(border);
JTextField newValueField = new JTextField("value");
newValueField.setBorder(border);
JCheckBox newCheckBox = new JCheckBox();
JButton newDelete = new JButton(new ImageIcon("C:\\Users\\Lenovo\\IdeaProjects\\Insomnia\\src\\image\\1000582.png"));
JPanel newRightOfHeader = new JPanel();
newRightOfHeader.add(newCheckBox);
newRightOfHeader.add(newDelete);
JPanel new_center_header = new JPanel(new GridLayout(1, 2));
new_center_header.add(newHeaderField);
new_center_header.add(newValueField);
JPanel newHeader = new JPanel(new BorderLayout());
newHeader.add(newRightOfHeader, BorderLayout.EAST);
newHeader.add(new_center_header, BorderLayout.CENTER);
mainCenterHeader.add(newHeader);
}
}
}
// Exit app // Exit app
public class exitApp implements ActionListener public class exitApp implements ActionListener
{ {
...@@ -501,38 +243,38 @@ public class InsomniaGUI { ...@@ -501,38 +243,38 @@ public class InsomniaGUI {
if (checkbox.isSelected() == true){ if (checkbox.isSelected() == true){
TrayIcon trayIcon; TrayIcon trayIcon;
SystemTray tray; SystemTray tray;
if(SystemTray.isSupported()){ if(SystemTray.isSupported()){
System.out.println("system tray supported"); System.out.println("system tray supported");
tray=SystemTray.getSystemTray(); tray=SystemTray.getSystemTray();
Image image=Toolkit.getDefaultToolkit().getImage("/media/faisal/DukeImg/Duke256.png"); Image image=Toolkit.getDefaultToolkit().getImage("/media/faisal/DukeImg/Duke256.png");
ActionListener exitListener=new ActionListener() { ActionListener exitListener=new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
System.out.println("Exiting...."); System.out.println("Exiting....");
System.exit(0); System.exit(0);
} }
}; };
PopupMenu popup=new PopupMenu(); PopupMenu popup=new PopupMenu();
MenuItem defaultItem=new MenuItem("Exit"); MenuItem defaultItem=new MenuItem("Exit");
defaultItem.addActionListener(exitListener); defaultItem.addActionListener(exitListener);
popup.add(defaultItem); popup.add(defaultItem);
defaultItem=new MenuItem("Open"); defaultItem=new MenuItem("Open");
defaultItem.addActionListener(new ActionListener() { defaultItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
setVisible(true); setVisible(true);
frame.setExtendedState(NORMAL); frame.setExtendedState(NORMAL);
} }
}); });
popup.add(defaultItem); popup.add(defaultItem);
trayIcon=new TrayIcon(image, "SystemTray Demo", popup); trayIcon=new TrayIcon(image, "SystemTray Demo", popup);
trayIcon.setImageAutoSize(true); trayIcon.setImageAutoSize(true);
}else{ }else{
System.out.println("system tray not supported"); System.out.println("system tray not supported");
} }
setVisible(true); setVisible(true);
} }
else else
System.exit(0); System.exit(0);
} }
} }
} }
import javax.swing.*;
import javax.swing.border.Border;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
public class LeftPanel extends JPanel {
Border border = BorderFactory.createLineBorder(Color.BLACK,3);
VerticalFlowLayout vfLayout = new VerticalFlowLayout();
JButton addRequest = new JButton("Add Request");
JMenu menu = new JMenu("Insomnia");
JPanel requestList = new JPanel(vfLayout);
JScrollPane scrollRequests = new JScrollPane(requestList);
JPanel up_left = new JPanel(new GridLayout(2,1));
//left panel (list of requests)
public void createLeftPanel() {
menu.setFont(new Font("Arial",20,15 ));
menu.setBorder(border);
menu.setPreferredSize(new Dimension(200,60));
up_left.add(menu);
up_left.add(addRequest);
up_left.setBackground(Color.GRAY);
requestList.setBackground(Color.GRAY);
addRequest.addMouseListener(new MouseListener() {
@Override
public void mouseClicked(MouseEvent e) {
int i = 1;
JLabel jLabel= new JLabel("request"+i);
requestList.add(jLabel);
i++;
}
@Override
public void mousePressed(MouseEvent e) {
}
@Override
public void mouseReleased(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
});
this.setLayout(new BorderLayout());
this.setBackground(Color.GRAY);
this.add(up_left, BorderLayout.NORTH);
this.add(scrollRequests, BorderLayout.CENTER);
this.setBackground(Color.LIGHT_GRAY);
}
public JButton getAddRequest() {
return addRequest;
}
public JMenu getMenu() {
return menu;
}
public JPanel getRequestList() {
return requestList;
}
public JScrollPane getScrollRequests() {
return scrollRequests;
}
public JPanel getUp_left() {
return up_left;
}
}
import javax.imageio.ImageIO;
import javax.swing.*;
import javax.swing.border.Border;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
public class RequestPanel extends JPanel {
private VerticalFlowLayout vfLayout = new VerticalFlowLayout();
private JPanel body = new JPanel();
private JPanel auth = new JPanel();
private JPanel query = new JPanel();
private JPanel mainCenterHeader = new JPanel(vfLayout);
private JScrollPane scrollPane_Header_Request = new JScrollPane(mainCenterHeader);
JPanel docs = new JPanel();
JTabbedPane tabbedPaneCenterRequest = new JTabbedPane();
JTextField headerField = new JTextField("header");
JTextField valueField = new JTextField("value");
JCheckBox checkBox = new JCheckBox();
JButton delete = new JButton();
JPanel rightOfHeader = new JPanel();
JPanel center_header = new JPanel(new GridLayout(1,2));
JPanel header = new JPanel(new BorderLayout());
String s []={"Patch","Put","Post","Delete","Get"};
JComboBox centerMenu = new JComboBox(s);
JTextField URLTextField = new JTextField("http://api.myproduct.com/v1/users");
JButton sendButton = new JButton("send");
JPanel centerUp = new JPanel(new BorderLayout());
public JTabbedPane tabbedPaneCenterRequest() throws IOException {
Border border = BorderFactory.createLineBorder(Color.BLACK,3);
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);
body.setBackground(Color.GRAY);
auth.setBackground(Color.GRAY);
query.setBackground(Color.GRAY);
mainCenterHeader.setBackground(Color.GRAY);
scrollPane_Header_Request.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
docs.setBackground(Color.GRAY);
//request-center
tabbedPaneCenterRequest.setBackground(Color.GRAY);
tabbedPaneCenterRequest.add("Body" , body);
tabbedPaneCenterRequest.add("Auth" , auth);
tabbedPaneCenterRequest.add("Query" , query);
tabbedPaneCenterRequest.add("Header" , scrollPane_Header_Request);
tabbedPaneCenterRequest.add("Docs" , docs);
headerField.addMouseListener(new MouseListener() {
@Override
public void mouseClicked(MouseEvent e) {
JTextField newHeaderField = new JTextField("header");
newHeaderField.setBorder(border);
JTextField newValueField = new JTextField("value");
newValueField.setBorder(border);
JCheckBox newCheckBox = new JCheckBox();
JButton newDelete = new JButton();
newDelete.setPreferredSize(new Dimension(20,20));
newDelete.setIcon(new ImageIcon(scaled));
JPanel newRightOfHeader = new JPanel();
newRightOfHeader.add(newCheckBox);
newRightOfHeader.add(newDelete);
JPanel new_center_header = new JPanel(new GridLayout(1, 2));
new_center_header.add(newHeaderField);
new_center_header.add(newValueField);
JPanel newHeader = new JPanel(new BorderLayout());
newHeader.add(newRightOfHeader, BorderLayout.EAST);
newHeader.add(new_center_header, BorderLayout.CENTER);
mainCenterHeader.add(newHeader );
}
@Override
public void mousePressed(MouseEvent e) {
}
@Override
public void mouseReleased(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
});
RequestPanel.TextFieldHandler textFieldHandler = new TextFieldHandler(headerField,mainCenterHeader,border);//create a actionListener
headerField.setFocusable(true);
headerField.addActionListener( textFieldHandler);
headerField.setBorder(border);
valueField.setBorder(border);
delete.setIcon(new ImageIcon(scaled));
delete.setPreferredSize(new Dimension(20,20));
rightOfHeader.add(checkBox);
rightOfHeader.add(delete);
center_header.add(headerField);
center_header.add(valueField);
header.add(rightOfHeader,BorderLayout.EAST);
header.add(center_header,BorderLayout.CENTER);
mainCenterHeader.add(header);
return tabbedPaneCenterRequest;
}
//request_up
public JPanel centerUp(){
centerMenu.setFont(new Font("Arial",20,15 ));
centerUp.add(centerMenu , BorderLayout.WEST);
centerUp.add(URLTextField , BorderLayout.CENTER);
centerUp.add(sendButton , BorderLayout.EAST);
return centerUp;
}
class TextFieldHandler implements ActionListener {
JTextField headerField ;
JPanel mainCenterHeader;
Border border;
private TextFieldHandler(JTextField headerField , JPanel mainCenterHeader , Border border){
this.headerField = headerField;
this.mainCenterHeader = mainCenterHeader;
this.border = border;
}
@Override
public void actionPerformed(ActionEvent e) {
System.out.println("++++++++++++");
if (!headerField.getText().equals("") ) {
JTextField newHeaderField = new JTextField("header");
newHeaderField.setBorder(border);
JTextField newValueField = new JTextField("value");
newValueField.setBorder(border);
JCheckBox newCheckBox = new JCheckBox();
JButton newDelete = new JButton(new ImageIcon("C:\\Users\\Lenovo\\IdeaProjects\\Insomnia\\src\\image\\1000582.png"));
JPanel newRightOfHeader = new JPanel();
newRightOfHeader.add(newCheckBox);
newRightOfHeader.add(newDelete);
JPanel new_center_header = new JPanel(new GridLayout(1, 2));
new_center_header.add(newHeaderField);
new_center_header.add(newValueField);
JPanel newHeader = new JPanel(new BorderLayout());
newHeader.add(newRightOfHeader, BorderLayout.EAST);
newHeader.add(new_center_header, BorderLayout.CENTER);
mainCenterHeader.add(newHeader);
}
}
}
public void createRequestPanel() throws IOException {
addToMainRequestPanel(centerUp() , tabbedPaneCenterRequest());
}
public void addToMainRequestPanel(JPanel centerUp ,JTabbedPane tabbedPaneCenterRequest ){
this.setLayout(new BorderLayout());
this.add(centerUp,BorderLayout.NORTH);
this.add(tabbedPaneCenterRequest , BorderLayout.CENTER);
}
public JPanel getRightOfHeader() {
return rightOfHeader;
}
public JPanel getCenter_header() {
return center_header;
}
public JPanel getBody() {
return body;
}
public JPanel getAuth() {
return auth;
}
public JPanel getQuery() {
return query;
}
public JPanel getMainCenterHeader() {
return mainCenterHeader;
}
public JScrollPane getScrollPane_Header_Request() {
return scrollPane_Header_Request;
}
public JPanel getDocs() {
return docs;
}
public JTabbedPane getTabbedPaneCenterRequest() {
return tabbedPaneCenterRequest;
}
public JPanel getHeader() {
return header;
}
public JComboBox getCenterMenu() {
return centerMenu;
}
public JPanel getCenterUp() {
return centerUp;
}
}
import javax.swing.*;
import javax.swing.border.Border;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
public class RespondPanel extends JPanel {
private Border border = BorderFactory.createLineBorder(Color.BLACK,3);
private VerticalFlowLayout vfLayout = new VerticalFlowLayout();
private JPanel row = new JPanel();
private JTextArea massageBody = new JTextArea();
private JPanel mainCenterHeader_respond = new JPanel(vfLayout);
private JScrollPane scrollPane_Header_Respond = new JScrollPane(mainCenterHeader_respond);
private JPanel header_MainPanel = new JPanel(new BorderLayout());
private JButton copyToClipBoard = new JButton("copy to clip board");
private JPanel cookie = new JPanel();
private JPanel timeline = new JPanel(new BorderLayout());
private JTabbedPane tabbedPaneCenterResponse = new JTabbedPane();
private JTextField headerField2 = new JTextField("header");
public JTabbedPane tabbedPaneCenterResponse() {
massageBody.setPreferredSize(new Dimension(200, 300));
row.add(massageBody);
row.setBackground(Color.GRAY);
scrollPane_Header_Respond.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
mainCenterHeader_respond.setBackground(Color.GRAY);
header_MainPanel.setBackground(Color.GRAY);
header_MainPanel.add(scrollPane_Header_Respond, BorderLayout.CENTER);
header_MainPanel.add(copyToClipBoard, BorderLayout.SOUTH);
cookie.setBackground(Color.GRAY);
timeline.setBackground(Color.GRAY);
tabbedPaneCenterResponse.setBackground(Color.GRAY);
tabbedPaneCenterResponse.add("Row", row);
tabbedPaneCenterResponse.add("Header", header_MainPanel);
tabbedPaneCenterResponse.add("Cookie", cookie);
tabbedPaneCenterResponse.add("Timeline", timeline);
headerField2.setEditable(false);
headerField2.addMouseListener(new MouseListener() {
@Override
public void mouseClicked(MouseEvent e) {
System.out.println(")))))))))))");
// if (!headerField2.getText().equals("") ) {
JTextField newHeaderField = new JTextField("header");
newHeaderField.setEditable(false);
newHeaderField.setBorder(border);
JTextField newValueField = new JTextField("value");
newValueField.setEditable(false);
newValueField.setBorder(border);
JPanel new_center_header = new JPanel(new GridLayout(1, 2));
new_center_header.add(newHeaderField);
new_center_header.add(newValueField);
JPanel newHeader = new JPanel(new BorderLayout());
newHeader.add(new_center_header, BorderLayout.CENTER);
mainCenterHeader_respond.add(newHeader);
// }
}
@Override
public void mousePressed(MouseEvent e) {
}
@Override
public void mouseReleased(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
});
headerField2.setBorder(border);
JTextField valueField2 = new JTextField("value");
valueField2.setEditable(false);
valueField2.setBorder(border);
JPanel center_header2 = new JPanel(new GridLayout(1, 2));
center_header2.add(headerField2);
center_header2.add(valueField2);
JPanel header2 = new JPanel(new BorderLayout());
header2.add(center_header2, BorderLayout.CENTER);
mainCenterHeader_respond.add(header2);
return tabbedPaneCenterResponse;
}
public JPanel up_response() {
JPanel up_response = new JPanel();
JLabel label1 = new JLabel("ok");
label1.setBorder(border);
JLabel label2 = new JLabel("s");
label2.setBorder(border);
JLabel label3 = new JLabel("KB");
label3.setBorder(border);
up_response.add(label1);
up_response.add(label2);
up_response.add(label3);
return up_response;
}
public void createRespondPanel(){
addToMainRespondPanel(tabbedPaneCenterResponse() , up_response());
}
public void addToMainRespondPanel(JTabbedPane tabbedPaneCenterResponse, JPanel up_response){
this.setLayout(new BorderLayout());
this.add(tabbedPaneCenterResponse , BorderLayout.CENTER);
this.add(up_response,BorderLayout.NORTH);
}
public JTextArea getMassageBody() {
return massageBody;
}
public JPanel getMainCenterHeader_respond() {
return mainCenterHeader_respond;
}
public JScrollPane getScrollPane_Header_Respond() {
return scrollPane_Header_Respond;
}
public JPanel getHeader_MainPanel() {
return header_MainPanel;
}
public JButton getCopyToClipBoard() {
return copyToClipBoard;
}
public JPanel getCookie() {
return cookie;
}
public JPanel getTimeline() {
return timeline;
}
public JTabbedPane getTabbedPaneCenterResponse() {
return tabbedPaneCenterResponse;
}
public JTextField getHeaderField2() {
return headerField2;
}
public JPanel getRow() {
return row;
}
}
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