Skip to content

Commit be72922

Browse files
committed
Added GUI demo selector
1 parent 2e45299 commit be72922

File tree

2 files changed

+213
-0
lines changed

2 files changed

+213
-0
lines changed

src/main/java/Demo/DemoSelector.form

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
3+
<Form version="1.9" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
4+
<Properties>
5+
<Property name="defaultCloseOperation" type="int" value="3"/>
6+
<Property name="title" type="java.lang.String" value="Demo Selector"/>
7+
<Property name="resizable" type="boolean" value="false"/>
8+
</Properties>
9+
<SyntheticProperties>
10+
<SyntheticProperty name="formSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,0,86,0,0,1,-70"/>
11+
<SyntheticProperty name="formSizePolicy" type="int" value="0"/>
12+
<SyntheticProperty name="generateSize" type="boolean" value="true"/>
13+
<SyntheticProperty name="generateCenter" type="boolean" value="true"/>
14+
</SyntheticProperties>
15+
<AuxValues>
16+
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
17+
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
18+
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
19+
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
20+
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
21+
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
22+
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
23+
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
24+
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
25+
</AuxValues>
26+
27+
<Layout>
28+
<DimensionLayout dim="0">
29+
<Group type="103" groupAlignment="0" attributes="0">
30+
<Group type="102" attributes="0">
31+
<EmptySpace max="-2" attributes="0"/>
32+
<Component id="btnTicket" min="-2" pref="206" max="-2" attributes="0"/>
33+
<EmptySpace max="-2" attributes="0"/>
34+
<Component id="btnEngine" min="-2" pref="206" max="-2" attributes="0"/>
35+
<EmptySpace max="32767" attributes="0"/>
36+
</Group>
37+
</Group>
38+
</DimensionLayout>
39+
<DimensionLayout dim="1">
40+
<Group type="103" groupAlignment="0" attributes="0">
41+
<Group type="102" attributes="0">
42+
<EmptySpace max="-2" attributes="0"/>
43+
<Group type="103" groupAlignment="3" attributes="0">
44+
<Component id="btnTicket" alignment="3" min="-2" pref="39" max="-2" attributes="0"/>
45+
<Component id="btnEngine" alignment="3" min="-2" pref="39" max="-2" attributes="0"/>
46+
</Group>
47+
<EmptySpace max="32767" attributes="0"/>
48+
</Group>
49+
</Group>
50+
</DimensionLayout>
51+
</Layout>
52+
<SubComponents>
53+
<Component class="javax.swing.JButton" name="btnTicket">
54+
<Properties>
55+
<Property name="text" type="java.lang.String" value="Ticket API"/>
56+
</Properties>
57+
<Events>
58+
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnTicketActionPerformed"/>
59+
</Events>
60+
</Component>
61+
<Component class="javax.swing.JButton" name="btnEngine">
62+
<Properties>
63+
<Property name="text" type="java.lang.String" value="Engine API"/>
64+
</Properties>
65+
<Events>
66+
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnEngineActionPerformed"/>
67+
</Events>
68+
</Component>
69+
</SubComponents>
70+
</Form>

src/main/java/Demo/DemoSelector.java

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
/**
2+
* This file is part of Qlik Sense Java Examples <https://github.com/StevenJDH/Qlik-Sense-Java-Examples>.
3+
* Copyright (C) 2020 Steven Jenkins De Haro.
4+
*
5+
* Qlik Sense Java Examples is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* Qlik Sense Java Examples is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with Qlik Sense Java Examples. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
19+
package Demo;
20+
21+
import EngineAPI.EngineCallDemo;
22+
import TicketAPI.TicketRequestDemo;
23+
24+
/**
25+
* DemoSelector.java (UTF-8)
26+
* Allows for the selection of the different demos that are available.
27+
*
28+
* @version 1.0
29+
* @author Steven Jenkins De Haro
30+
*/
31+
public class DemoSelector extends javax.swing.JFrame {
32+
33+
/**
34+
* Creates new form DemoSelector
35+
*/
36+
public DemoSelector() {
37+
initComponents();
38+
}
39+
40+
/**
41+
* This method is called from within the constructor to initialize the form.
42+
* WARNING: Do NOT modify this code. The content of this method is always
43+
* regenerated by the Form Editor.
44+
*/
45+
@SuppressWarnings("unchecked")
46+
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
47+
private void initComponents() {
48+
49+
btnTicket = new javax.swing.JButton();
50+
btnEngine = new javax.swing.JButton();
51+
52+
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
53+
setTitle("Demo Selector");
54+
setResizable(false);
55+
56+
btnTicket.setText("Ticket API");
57+
btnTicket.addActionListener(new java.awt.event.ActionListener() {
58+
public void actionPerformed(java.awt.event.ActionEvent evt) {
59+
btnTicketActionPerformed(evt);
60+
}
61+
});
62+
63+
btnEngine.setText("Engine API");
64+
btnEngine.addActionListener(new java.awt.event.ActionListener() {
65+
public void actionPerformed(java.awt.event.ActionEvent evt) {
66+
btnEngineActionPerformed(evt);
67+
}
68+
});
69+
70+
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
71+
getContentPane().setLayout(layout);
72+
layout.setHorizontalGroup(
73+
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
74+
.addGroup(layout.createSequentialGroup()
75+
.addContainerGap()
76+
.addComponent(btnTicket, javax.swing.GroupLayout.PREFERRED_SIZE, 206, javax.swing.GroupLayout.PREFERRED_SIZE)
77+
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
78+
.addComponent(btnEngine, javax.swing.GroupLayout.PREFERRED_SIZE, 206, javax.swing.GroupLayout.PREFERRED_SIZE)
79+
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
80+
);
81+
layout.setVerticalGroup(
82+
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
83+
.addGroup(layout.createSequentialGroup()
84+
.addContainerGap()
85+
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
86+
.addComponent(btnTicket, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
87+
.addComponent(btnEngine, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
88+
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
89+
);
90+
91+
setSize(new java.awt.Dimension(442, 86));
92+
setLocationRelativeTo(null);
93+
}// </editor-fold>//GEN-END:initComponents
94+
95+
private void btnTicketActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnTicketActionPerformed
96+
new TicketRequestDemo().setVisible(true);
97+
}//GEN-LAST:event_btnTicketActionPerformed
98+
99+
private void btnEngineActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEngineActionPerformed
100+
new EngineCallDemo().setVisible(true);
101+
}//GEN-LAST:event_btnEngineActionPerformed
102+
103+
/**
104+
* @param args the command line arguments
105+
*/
106+
public static void main(String args[]) {
107+
/* Set the Nimbus look and feel */
108+
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
109+
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
110+
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
111+
*/
112+
try {
113+
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
114+
if ("Nimbus".equals(info.getName())) {
115+
javax.swing.UIManager.setLookAndFeel(info.getClassName());
116+
break;
117+
}
118+
}
119+
} catch (ClassNotFoundException ex) {
120+
java.util.logging.Logger.getLogger(DemoSelector.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
121+
} catch (InstantiationException ex) {
122+
java.util.logging.Logger.getLogger(DemoSelector.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
123+
} catch (IllegalAccessException ex) {
124+
java.util.logging.Logger.getLogger(DemoSelector.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
125+
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
126+
java.util.logging.Logger.getLogger(DemoSelector.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
127+
}
128+
//</editor-fold>
129+
130+
/* Create and display the form */
131+
java.awt.EventQueue.invokeLater(new Runnable() {
132+
@Override
133+
public void run() {
134+
new DemoSelector().setVisible(true);
135+
}
136+
});
137+
}
138+
139+
// Variables declaration - do not modify//GEN-BEGIN:variables
140+
private javax.swing.JButton btnEngine;
141+
private javax.swing.JButton btnTicket;
142+
// End of variables declaration//GEN-END:variables
143+
}

0 commit comments

Comments
 (0)