Lab 8 showcase
This commit is contained in:
parent
e58900b603
commit
31c6e31a21
|
@ -2,15 +2,10 @@
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="ca0c2a3b-945d-4afb-91a0-609004d30ee5" name="Changes" comment="">
|
<list default="true" id="ca0c2a3b-945d-4afb-91a0-609004d30ee5" name="Changes" comment="">
|
||||||
<change afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/src/ComponentShowcase.form" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/src/ComponentShowcase.java" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/uiDesigner.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/Main.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Main.java" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/Lab8.iml" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/src/Main.form" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/src/Main.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" />
|
||||||
|
@ -31,7 +26,9 @@
|
||||||
<option name="stateVersion" value="1" />
|
<option name="stateVersion" value="1" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectId" id="2IWw9vt2forFBJVAq4mPhuVkfmv" />
|
<component name="ProjectId" id="2IWw9vt2forFBJVAq4mPhuVkfmv" />
|
||||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
|
||||||
|
<ConfirmationsSetting value="2" id="Add" />
|
||||||
|
</component>
|
||||||
<component name="ProjectViewState">
|
<component name="ProjectViewState">
|
||||||
<option name="hideEmptyMiddlePackages" value="true" />
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
<option name="showLibraryContents" value="true" />
|
<option name="showLibraryContents" value="true" />
|
||||||
|
|
|
@ -0,0 +1,123 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="ComponentShowcase">
|
||||||
|
<grid id="27dc6" binding="JPan" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<xy x="20" y="20" width="500" height="400"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none"/>
|
||||||
|
<children>
|
||||||
|
<grid id="b4ac7" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none"/>
|
||||||
|
<children>
|
||||||
|
<component id="a1b30" class="javax.swing.JRadioButton" binding="radioButton1" default-binding="true">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Server Hydrogen"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="e7649" class="javax.swing.JRadioButton" binding="radioButton2" default-binding="true">
|
||||||
|
<constraints>
|
||||||
|
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Server Helium"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="80c" class="javax.swing.JCheckBox" binding="useNewCredentialsCheckBox" default-binding="true">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Use new credentials"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="db9a6" class="javax.swing.JCheckBox" binding="doNotLogOutCheckBox" default-binding="true">
|
||||||
|
<constraints>
|
||||||
|
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Do not log out after"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
<grid id="272a1" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none"/>
|
||||||
|
<children>
|
||||||
|
<component id="4cc15" class="javax.swing.JTextField" binding="usernameField">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||||
|
<preferred-size width="150" height="-1"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
</component>
|
||||||
|
<component id="b46b3" class="javax.swing.JLabel">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Username"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="c7ded" class="javax.swing.JLabel">
|
||||||
|
<constraints>
|
||||||
|
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Password"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="58235" class="javax.swing.JTextField" binding="passwordField">
|
||||||
|
<constraints>
|
||||||
|
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||||
|
<preferred-size width="150" height="-1"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
</component>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
<grid id="a23d2" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none"/>
|
||||||
|
<children>
|
||||||
|
<component id="8f721" class="javax.swing.JButton" binding="loginButton" default-binding="true">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Login"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="d8216" class="javax.swing.JButton" binding="closeButton" default-binding="true">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<text value="Close"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
</form>
|
|
@ -0,0 +1,61 @@
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
|
||||||
|
public class ComponentShowcase extends JFrame {
|
||||||
|
private JPanel JPan;
|
||||||
|
private JRadioButton radioButton1;
|
||||||
|
private JRadioButton radioButton2;
|
||||||
|
private JCheckBox useNewCredentialsCheckBox;
|
||||||
|
private JCheckBox doNotLogOutCheckBox;
|
||||||
|
private JTextField usernameField;
|
||||||
|
private JTextField passwordField;
|
||||||
|
private JButton loginButton;
|
||||||
|
private JButton closeButton;
|
||||||
|
private ButtonGroup group;
|
||||||
|
|
||||||
|
public ComponentShowcase() {
|
||||||
|
super("Showcase");
|
||||||
|
|
||||||
|
group = new ButtonGroup();
|
||||||
|
|
||||||
|
group.add(radioButton1);
|
||||||
|
group.add(radioButton2);
|
||||||
|
|
||||||
|
this.setContentPane(this.JPan);
|
||||||
|
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
this.pack();
|
||||||
|
|
||||||
|
closeButton.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
dispose();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
loginButton.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
String msg = "";
|
||||||
|
|
||||||
|
String username = usernameField.getText();
|
||||||
|
String password = passwordField.getText();
|
||||||
|
|
||||||
|
if(username.isEmpty() || password.isEmpty()) msg += "Invalid username or password";
|
||||||
|
else msg += "Logging in as " + username + " (" + password + ")";
|
||||||
|
|
||||||
|
if(radioButton1.isSelected()) msg += "\nTried to connect to Hydrogen";
|
||||||
|
else if(radioButton2.isSelected()) msg += "\nTried to connect to Helium";
|
||||||
|
else msg += "\nTried to connect to unknown server";
|
||||||
|
|
||||||
|
if(useNewCredentialsCheckBox.isSelected()) msg += "\nSelected to use new credentials";
|
||||||
|
else msg += "\nSelected NOT to use new credentials";
|
||||||
|
|
||||||
|
if(doNotLogOutCheckBox.isSelected()) msg += "\nSelected to not log out";
|
||||||
|
else msg += "\nSelected to log out";
|
||||||
|
|
||||||
|
JOptionPane.showMessageDialog(null, msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,6 +10,9 @@ public class Main extends JFrame {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Main m = new Main();
|
Main m = new Main();
|
||||||
m.setVisible(true);
|
m.setVisible(true);
|
||||||
|
|
||||||
|
ComponentShowcase c = new ComponentShowcase();
|
||||||
|
c.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Main() {
|
public Main() {
|
||||||
|
|
Loading…
Reference in New Issue