Advertisement
Guest User

java project gui

a guest
Dec 17th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.22 KB | None | 0 0
  1. public class XFrame extends javax.swing.JFrame {
  2.  
  3.  
  4. public XFrame() {
  5. initComponents();
  6. }
  7.  
  8.  
  9. @SuppressWarnings("unchecked")
  10. // <editor-fold defaultstate="collapsed" desc="Generated Code">
  11. private void initComponents() {
  12.  
  13. jInternalFrame1 = new javax.swing.JInternalFrame();
  14. jButton1 = new javax.swing.JButton();
  15. jButton2 = new javax.swing.JButton();
  16. jComboBox1 = new javax.swing.JComboBox<>();
  17. jComboBox2 = new javax.swing.JComboBox<>();
  18. jLabel2 = new javax.swing.JLabel();
  19. jLabel3 = new javax.swing.JLabel();
  20. jMenuBar1 = new javax.swing.JMenuBar();
  21. jMenu1 = new javax.swing.JMenu();
  22. jMenuItem1 = new javax.swing.JMenuItem();
  23. jMenuItem2 = new javax.swing.JMenuItem();
  24. jMenu2 = new javax.swing.JMenu();
  25. jMenuItem3 = new javax.swing.JMenuItem();
  26.  
  27. setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  28.  
  29. jInternalFrame1.setTitle("CIU Airlines");
  30. jInternalFrame1.setVisible(true);
  31.  
  32. jButton1.setText("Search");
  33.  
  34. jButton2.setText("Clear");
  35.  
  36. jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
  37. jComboBox1.setActionCommand("fromComboBox");
  38.  
  39. jComboBox2.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
  40. jComboBox2.setActionCommand("toComboBox");
  41.  
  42. jLabel2.setText("From");
  43.  
  44. jLabel3.setText("To");
  45.  
  46. jMenu1.setText("Menu");
  47.  
  48. jMenuItem1.setText("Admin Panel");
  49. jMenuItem1.setActionCommand("adminPanelBTN");
  50. jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
  51. public void actionPerformed(java.awt.event.ActionEvent evt) {
  52. jMenuItem1ActionPerformed(evt);
  53. }
  54. });
  55. jMenu1.add(jMenuItem1);
  56.  
  57. jMenuItem2.setText("Quit");
  58. jMenuItem2.setActionCommand("quitBTN");
  59. jMenu1.add(jMenuItem2);
  60.  
  61. jMenuBar1.add(jMenu1);
  62.  
  63. jMenu2.setText("Help");
  64.  
  65. jMenuItem3.setText("Info");
  66. jMenuItem3.setActionCommand("infoMenuBTN");
  67. jMenu2.add(jMenuItem3);
  68.  
  69. jMenuBar1.add(jMenu2);
  70.  
  71. jInternalFrame1.setJMenuBar(jMenuBar1);
  72.  
  73. javax.swing.GroupLayout jInternalFrame1Layout = new javax.swing.GroupLayout(jInternalFrame1.getContentPane());
  74. jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout);
  75. jInternalFrame1Layout.setHorizontalGroup(
  76. jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  77. .addGroup(jInternalFrame1Layout.createSequentialGroup()
  78. .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  79. .addGroup(jInternalFrame1Layout.createSequentialGroup()
  80. .addGap(35, 35, 35)
  81. .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  82. .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE)
  83. .addComponent(jLabel2))
  84. .addGap(64, 64, 64)
  85. .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  86. .addComponent(jLabel3)
  87. .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE)))
  88. .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jInternalFrame1Layout.createSequentialGroup()
  89. .addContainerGap()
  90. .addComponent(jButton1)
  91. .addGap(37, 37, 37)
  92. .addComponent(jButton2)))
  93. .addContainerGap(47, Short.MAX_VALUE))
  94. );
  95. jInternalFrame1Layout.setVerticalGroup(
  96. jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  97. .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jInternalFrame1Layout.createSequentialGroup()
  98. .addGap(58, 58, 58)
  99. .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  100. .addComponent(jLabel2)
  101. .addComponent(jLabel3))
  102. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  103. .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  104. .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
  105. .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE))
  106. .addGap(68, 68, 68)
  107. .addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  108. .addComponent(jButton1)
  109. .addComponent(jButton2))
  110. .addContainerGap(15, Short.MAX_VALUE))
  111. );
  112.  
  113. javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  114. getContentPane().setLayout(layout);
  115. layout.setHorizontalGroup(
  116. layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  117. .addComponent(jInternalFrame1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  118. );
  119. layout.setVerticalGroup(
  120. layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  121. .addComponent(jInternalFrame1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  122. );
  123.  
  124. pack();
  125. }// </editor-fold>
  126.  
  127. private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {
  128. // TODO add your handling code here:
  129. }
  130.  
  131.  
  132. public static void main(String args[]) {
  133.  
  134. try {
  135. for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  136. if ("Nimbus".equals(info.getName())) {
  137. javax.swing.UIManager.setLookAndFeel(info.getClassName());
  138. break;
  139. }
  140. }
  141. } catch (ClassNotFoundException ex) {
  142. java.util.logging.Logger.getLogger(XFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  143. } catch (InstantiationException ex) {
  144. java.util.logging.Logger.getLogger(XFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  145. } catch (IllegalAccessException ex) {
  146. java.util.logging.Logger.getLogger(XFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  147. } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  148. java.util.logging.Logger.getLogger(XFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  149. }
  150. //</editor-fold>
  151.  
  152.  
  153. java.awt.EventQueue.invokeLater(new Runnable() {
  154. public void run() {
  155. new XFrame().setVisible(true);
  156. }
  157. });
  158. }
  159.  
  160. // Variables declaration - do not modify
  161. private javax.swing.JButton jButton1;
  162. private javax.swing.JButton jButton2;
  163. private javax.swing.JComboBox<String> jComboBox1;
  164. private javax.swing.JComboBox<String> jComboBox2;
  165. private javax.swing.JInternalFrame jInternalFrame1;
  166. private javax.swing.JLabel jLabel2;
  167. private javax.swing.JLabel jLabel3;
  168. private javax.swing.JMenu jMenu1;
  169. private javax.swing.JMenu jMenu2;
  170. private javax.swing.JMenuBar jMenuBar1;
  171. private javax.swing.JMenuItem jMenuItem1;
  172. private javax.swing.JMenuItem jMenuItem2;
  173. private javax.swing.JMenuItem jMenuItem3;
  174. // End of variables declaration
  175. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement