|
| 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