/*
* MainForm.java
*
* Created on 16 de Julho de 2008, 11:25
*/
package examples;
/**
*
* @author João Carlos
*/
public class MainForm extends javax.swing.JFrame {
/** Creates new form MainForm */
public MainForm() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
//@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
jList1 = new javax.swing.JList();
jLabel1 = new javax.swing.JLabel();
jRadioButton2 = new javax.swing.JRadioButton();
jRadioButton3 = new javax.swing.JRadioButton();
Exit = new javax.swing.JButton();
Edit = new javax.swing.JButton();
Find = new javax.swing.JButton();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMenu2 = new javax.swing.JMenu();
jMenu3 = new javax.swing.JMenu();
jMenu4 = new javax.swing.JMenu();
jMenu5 = new javax.swing.JMenu();
Exit.setEnabled(true);
Edit.setEnabled(true);
Find.setEnabled(true);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setResizable(false);
jList1.setModel(new javax.swing.AbstractListModel() {
String[] strings = { "jcsilva@ipca.pt", "jcsilval@hotmail.com" };
public int getSize() { return strings.length; }
public Object getElementAt(int i) { return strings[i]; }
});
jScrollPane1.setViewportView(jList1);
jLabel1.setText("Format:");
jRadioButton2.setSelected(true);
jRadioButton2.setText("E-mail");
jRadioButton2.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
jRadioButton2.setMargin(new java.awt.Insets(0, 0, 0, 0));
jRadioButton3.setText("Name");
jRadioButton3.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
jRadioButton3.setMargin(new java.awt.Insets(0, 0, 0, 0));
Exit.setText("Exit");
Exit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ExitActionPerformed(evt);
}
});
Edit.setText("Edit");
Edit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
EditActionPerformed(evt);
}
});
Find.setText("Find");
Find.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
FindActionPerformed(evt);
}
});
jMenu1.setText("File");
jMenuBar1.add(jMenu1);
jMenu2.setText("Edit");
jMenuBar1.add(jMenu2);
jMenu3.setText("Find");
jMenuBar1.add(jMenu3);
jMenu4.setText("Client");
jMenuBar1.add(jMenu4);
jMenu5.setText("Help");
jMenuBar1.add(jMenu5);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 262, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(Find, javax.swing.GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE)
.addComponent(Edit, javax.swing.GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE)
.addComponent(Exit, javax.swing.GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE)))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jRadioButton2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jRadioButton3)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(Find)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(Edit)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE)
.addComponent(Exit))
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 103, Short.MAX_VALUE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jRadioButton2)
.addComponent(jRadioButton3))
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void ExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ExitActionPerformed
// TODO add your handling code here:
System.exit(0);
}//GEN-LAST:event_ExitActionPerformed
private void EditActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_EditActionPerformed
// TODO add your handling code here:
//
if (true)
new ContactEditor().setVisible(true);
else javax.swing.JOptionPane.showMessageDialog(this, "\n", "There are no contacts", 0);
}//GEN-LAST:event_EditActionPerformed
private void FindActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FindActionPerformed
// TODO add your handling code here:
if (true)
new Find().setVisible(true);
else javax.swing.JOptionPane.showMessageDialog(this, "\n", "There are no contacts", 0);
}//GEN-LAST:event_FindActionPerformed
public static void main(String args[]) {
new MainForm().setVisible(true);
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton Edit;
private javax.swing.JButton Exit;
private javax.swing.JButton Find;
private javax.swing.JLabel jLabel1;
private javax.swing.JList jList1;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenu jMenu3;
private javax.swing.JMenu jMenu4;
private javax.swing.JMenu jMenu5;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JRadioButton jRadioButton2;
private javax.swing.JRadioButton jRadioButton3;
private javax.swing.JScrollPane jScrollPane1;
// End of variables declaration//GEN-END:variables
}
|