use of javax.swing.GroupLayout in project JMRI by JMRI.
the class ProfilePreferencesPanel method 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")
private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
void initComponents() {
profilesPopupMenu = new JPopupMenu();
renameMI = new JMenuItem();
jSeparator1 = new JPopupMenu.Separator();
copyMI = new JMenuItem();
deleteMI = new JMenuItem();
grpStartWithSelectors = new ButtonGroup();
jTabbedPane1 = new JTabbedPane();
enabledPanel = new JPanel();
jScrollPane1 = new JScrollPane();
profilesTbl = new JTable() {
//Implement table cell tool tips.
public String getToolTipText(MouseEvent e) {
try {
return getValueAt(rowAtPoint(e.getPoint()), -1).toString();
} catch (RuntimeException e1) {
//catch null pointer exception if mouse is over an empty line
}
return null;
}
};
btnOpenExistingProfile = new JButton();
btnDeleteProfile = new JButton();
btnCreateNewProfile = new JButton();
btnActivateProfile = new JButton();
btnExportProfile = new JButton();
btnCopyProfile = new JButton();
spinnerTimeout = new JSpinner();
jLabel1 = new JLabel();
rdoStartWithActiveProfile = new JRadioButton();
rdoStartWithProfileSelector = new JRadioButton();
searchPathsPanel = new JPanel();
btnRemoveSearchPath = new JButton();
btnAddSearchPath = new JButton();
jScrollPane3 = new JScrollPane();
searchPathsTbl = new JTable() {
//Implement table cell tool tips.
public String getToolTipText(MouseEvent e) {
try {
return getValueAt(rowAtPoint(e.getPoint()), -1).toString();
} catch (RuntimeException e1) {
//catch null pointer exception if mouse is over an empty line
}
return null;
}
};
profilesPopupMenu.addPopupMenuListener(new PopupMenuListener() {
public void popupMenuWillBecomeVisible(PopupMenuEvent evt) {
profilesPopupMenuPopupMenuWillBecomeVisible(evt);
}
public void popupMenuWillBecomeInvisible(PopupMenuEvent evt) {
}
public void popupMenuCanceled(PopupMenuEvent evt) {
}
});
// NOI18N
ResourceBundle bundle = ResourceBundle.getBundle("jmri/profile/Bundle");
// NOI18N
renameMI.setText(bundle.getString("ProfilePreferencesPanel.renameMI.text"));
renameMI.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
renameMIActionPerformed(evt);
}
});
profilesPopupMenu.add(renameMI);
profilesPopupMenu.add(jSeparator1);
// NOI18N
copyMI.setText(bundle.getString("ProfilePreferencesPanel.copyMI.text"));
profilesPopupMenu.add(copyMI);
// NOI18N
deleteMI.setText(bundle.getString("ProfilePreferencesPanel.deleteMI.text"));
profilesPopupMenu.add(deleteMI);
if (ProfileManager.getDefault().isAutoStartActiveProfile()) {
this.rdoStartWithActiveProfile.setSelected(true);
} else {
this.rdoStartWithProfileSelector.setSelected(true);
}
profilesTbl.setModel(new ProfileTableModel());
profilesTbl.getSelectionModel().addListSelectionListener(new ProfilesSelectionListener());
profilesTbl.getTableHeader().setReorderingAllowed(false);
jScrollPane1.setViewportView(profilesTbl);
// NOI18N
btnOpenExistingProfile.setText(bundle.getString("ProfilePreferencesPanel.btnOpenExistingProfile.text"));
// NOI18N
btnOpenExistingProfile.setToolTipText(bundle.getString("ProfilePreferencesPanel.btnOpenExistingProfile.toolTipText"));
btnOpenExistingProfile.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
btnOpenExistingProfileActionPerformed(evt);
}
});
// NOI18N
btnDeleteProfile.setText(bundle.getString("ProfilePreferencesPanel.btnDeleteProfile.text"));
// NOI18N
btnDeleteProfile.setToolTipText(bundle.getString("ProfilePreferencesPanel.btnDeleteProfile.toolTipText"));
btnDeleteProfile.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
btnDeleteProfileActionPerformed(evt);
}
});
// NOI18N
btnCreateNewProfile.setText(bundle.getString("ProfilePreferencesPanel.btnCreateNewProfile.text"));
// NOI18N
btnCreateNewProfile.setToolTipText(bundle.getString("ProfilePreferencesPanel.btnCreateNewProfile.toolTipText"));
btnCreateNewProfile.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
btnCreateNewProfileActionPerformed(evt);
}
});
// NOI18N
btnActivateProfile.setText(bundle.getString("ProfilePreferencesPanel.btnActivateProfile.text"));
// NOI18N
btnActivateProfile.setToolTipText(bundle.getString("ProfilePreferencesPanel.btnActivateProfile.toolTipText"));
btnActivateProfile.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
btnActivateProfileActionPerformed(evt);
}
});
// NOI18N
btnExportProfile.setText(bundle.getString("ProfilePreferencesPanel.btnExportProfile.text"));
// NOI18N
btnExportProfile.setToolTipText(bundle.getString("ProfilePreferencesPanel.btnExportProfile.toolTipText"));
btnExportProfile.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
btnExportProfileActionPerformed(evt);
}
});
// NOI18N
btnCopyProfile.setText(bundle.getString("ProfilePreferencesPanel.btnCopyProfile.text"));
btnCopyProfile.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
btnCopyProfileActionPerformed(evt);
}
});
spinnerTimeout.setModel(new SpinnerNumberModel(10, 0, 500, 1));
spinnerTimeout.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent evt) {
spinnerTimeoutStateChanged(evt);
}
});
// NOI18N
jLabel1.setText(bundle.getString("ProfilePreferencesPanel.jLabel1.text"));
grpStartWithSelectors.add(rdoStartWithActiveProfile);
// NOI18N
rdoStartWithActiveProfile.setText(bundle.getString("ProfilePreferencesPanel.rdoStartWithActiveProfile.text"));
rdoStartWithActiveProfile.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
rdoStartWithActiveProfileActionPerformed(evt);
}
});
grpStartWithSelectors.add(rdoStartWithProfileSelector);
// NOI18N
rdoStartWithProfileSelector.setText(bundle.getString("ProfilePreferencesPanel.rdoStartWithProfileSelector.text"));
rdoStartWithProfileSelector.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
rdoStartWithProfileSelectorActionPerformed(evt);
}
});
GroupLayout enabledPanelLayout = new GroupLayout(enabledPanel);
enabledPanel.setLayout(enabledPanelLayout);
enabledPanelLayout.setHorizontalGroup(enabledPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(enabledPanelLayout.createSequentialGroup().addContainerGap().addGroup(enabledPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane1).addGroup(enabledPanelLayout.createSequentialGroup().addComponent(btnActivateProfile).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(btnOpenExistingProfile).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(btnCreateNewProfile).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(btnCopyProfile).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(btnExportProfile).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 60, Short.MAX_VALUE).addComponent(btnDeleteProfile)).addGroup(enabledPanelLayout.createSequentialGroup().addGroup(enabledPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(rdoStartWithActiveProfile).addGroup(enabledPanelLayout.createSequentialGroup().addComponent(rdoStartWithProfileSelector).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(spinnerTimeout, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel1))).addGap(0, 0, Short.MAX_VALUE))).addContainerGap()));
enabledPanelLayout.setVerticalGroup(enabledPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(enabledPanelLayout.createSequentialGroup().addContainerGap().addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 190, Short.MAX_VALUE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(enabledPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(btnOpenExistingProfile).addComponent(btnCreateNewProfile).addComponent(btnActivateProfile).addComponent(btnExportProfile).addComponent(btnDeleteProfile).addComponent(btnCopyProfile)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(rdoStartWithActiveProfile).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(enabledPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(rdoStartWithProfileSelector).addComponent(spinnerTimeout, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(jLabel1))));
// NOI18N
jTabbedPane1.addTab(bundle.getString("ProfilePreferencesPanel.enabledPanel.TabConstraints.tabTitle"), enabledPanel);
// NOI18N
btnRemoveSearchPath.setText(bundle.getString("ProfilePreferencesPanel.btnRemoveSearchPath.text"));
// NOI18N
btnRemoveSearchPath.setToolTipText(bundle.getString("ProfilePreferencesPanel.btnRemoveSearchPath.toolTipText"));
btnRemoveSearchPath.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
btnRemoveSearchPathActionPerformed(evt);
}
});
// NOI18N
btnAddSearchPath.setText(bundle.getString("ProfilePreferencesPanel.btnAddSearchPath.text"));
// NOI18N
btnAddSearchPath.setToolTipText(bundle.getString("ProfilePreferencesPanel.btnAddSearchPath.toolTipText"));
btnAddSearchPath.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
btnAddSearchPathActionPerformed(evt);
}
});
searchPathsTbl.setModel(new SearchPathTableModel());
searchPathsTbl.getSelectionModel().addListSelectionListener(new SearchPathSelectionListener());
searchPathsTbl.getTableHeader().setReorderingAllowed(false);
jScrollPane3.setViewportView(searchPathsTbl);
GroupLayout searchPathsPanelLayout = new GroupLayout(searchPathsPanel);
searchPathsPanel.setLayout(searchPathsPanelLayout);
searchPathsPanelLayout.setHorizontalGroup(searchPathsPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(searchPathsPanelLayout.createSequentialGroup().addContainerGap().addGroup(searchPathsPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane3, GroupLayout.DEFAULT_SIZE, 667, Short.MAX_VALUE).addGroup(searchPathsPanelLayout.createSequentialGroup().addComponent(btnAddSearchPath).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(btnRemoveSearchPath))).addContainerGap()));
searchPathsPanelLayout.setVerticalGroup(searchPathsPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(searchPathsPanelLayout.createSequentialGroup().addContainerGap().addComponent(jScrollPane3, GroupLayout.DEFAULT_SIZE, 247, Short.MAX_VALUE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(searchPathsPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(btnAddSearchPath).addComponent(btnRemoveSearchPath)).addContainerGap()));
// NOI18N
jTabbedPane1.addTab(bundle.getString("ProfilePreferencesPanel.searchPathsPanel.TabConstraints.tabTitle_1"), searchPathsPanel);
GroupLayout layout = new GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jTabbedPane1, GroupLayout.Alignment.TRAILING));
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jTabbedPane1));
// NOI18N
jTabbedPane1.getAccessibleContext().setAccessibleName(bundle.getString("ProfilePreferencesPanel.enabledPanel.TabConstraints.tabTitle"));
}
use of javax.swing.GroupLayout in project JMRI by JMRI.
the class AddProfileDialog method 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")
private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
void initComponents() {
lblProfileNameAndLocation = new JLabel();
jSeparator2 = new JSeparator();
profileName = new JTextField();
lblProfileName = new JLabel();
lblProfileLocation = new JLabel();
profileLocation = new JTextField();
profileFolder = new JTextField();
btnBrowse = new JButton();
lblProfileFolder = new JLabel();
jSeparator1 = new JSeparator();
btnCancel = new JButton();
btnOk = new JButton();
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
// NOI18N
ResourceBundle bundle = ResourceBundle.getBundle("jmri/profile/Bundle");
// NOI18N
setTitle(bundle.getString("AddProfileDialog.title"));
setMinimumSize(new Dimension(413, 239));
lblProfileNameAndLocation.setFont(lblProfileNameAndLocation.getFont().deriveFont(lblProfileNameAndLocation.getFont().getStyle() | Font.BOLD));
// NOI18N
lblProfileNameAndLocation.setText(bundle.getString("AddProfileDialog.lblProfileNameAndLocation.text"));
profileName.setText("");
profileName.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
profileNameActionPerformed(null);
}
public void insertUpdate(DocumentEvent e) {
profileNameActionPerformed(null);
}
public void removeUpdate(DocumentEvent e) {
profileNameActionPerformed(null);
}
});
profileName.addFocusListener(new FocusAdapter() {
public void focusLost(FocusEvent evt) {
profileNameFocusLost(evt);
}
});
profileName.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
profileNameActionPerformed(evt);
}
});
profileName.addKeyListener(new KeyAdapter() {
public void keyTyped(KeyEvent evt) {
profileNameKeyTyped(evt);
}
});
// NOI18N
lblProfileName.setText(bundle.getString("AddProfileDialog.lblProfileName.text"));
// NOI18N
lblProfileLocation.setText(bundle.getString("AddProfileDialog.lblProfileLocation.text"));
profileLocation.setText(ProfileManager.getDefault().getDefaultSearchPath().getPath());
profileLocation.setMinimumSize(new Dimension(14, 128));
profileLocation.addFocusListener(new FocusAdapter() {
public void focusLost(FocusEvent evt) {
profileLocationFocusLost(evt);
}
});
profileLocation.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
profileLocationActionPerformed(evt);
}
});
profileLocation.addKeyListener(new KeyAdapter() {
public void keyTyped(KeyEvent evt) {
profileLocationKeyTyped(evt);
}
});
profileFolder.setEditable(false);
profileFolder.setText(ProfileManager.getDefault().getDefaultSearchPath().getPath());
profileFolder.setEnabled(false);
profileFolder.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
profileFolderActionPerformed(evt);
}
});
// NOI18N
btnBrowse.setText(bundle.getString("AddProfileDialog.btnBrowse.text"));
btnBrowse.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
btnBrowseActionPerformed(evt);
}
});
// NOI18N
lblProfileFolder.setText(bundle.getString("AddProfileDialog.lblProfileFolder.text"));
// NOI18N
btnCancel.setText(bundle.getString("AddProfileDialog.btnCancel.text"));
btnCancel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
btnCancelActionPerformed(evt);
}
});
// NOI18N
btnOk.setText(bundle.getString("AddProfileDialog.btnOk.text"));
btnOk.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
btnOkActionPerformed(evt);
}
});
GroupLayout layout = new GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jSeparator2).addGroup(layout.createSequentialGroup().addGap(6, 6, 6).addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(lblProfileName).addGap(24, 24, 24).addComponent(profileName, GroupLayout.DEFAULT_SIZE, 185, Short.MAX_VALUE)).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(lblProfileLocation).addComponent(lblProfileFolder)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(profileFolder).addComponent(profileLocation, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(btnBrowse)).addGroup(layout.createSequentialGroup().addComponent(lblProfileNameAndLocation).addGap(0, 0, Short.MAX_VALUE)).addComponent(jSeparator1).addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE).addComponent(btnOk).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(btnCancel))).addContainerGap()));
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(lblProfileNameAndLocation).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(jSeparator2, GroupLayout.PREFERRED_SIZE, 10, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(profileName, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(lblProfileName)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(profileLocation, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(btnBrowse).addComponent(lblProfileLocation)).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(profileFolder, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(lblProfileFolder)).addGap(18, 18, 18).addComponent(jSeparator1, GroupLayout.PREFERRED_SIZE, 10, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(btnCancel).addComponent(btnOk)).addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
pack();
}
use of javax.swing.GroupLayout in project JMRI by JMRI.
the class ProfileManagerDialog method 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")
private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
void initComponents() {
listLabel = new JLabel();
jScrollPane1 = new JScrollPane();
profiles = new JList<>();
btnSelect = new JButton();
btnCreate = new JButton();
btnUseExisting = new JButton();
countDownLbl = new JLabel();
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
// NOI18N
setTitle(Bundle.getMessage("ProfileManagerDialog.title"));
setMinimumSize(new Dimension(310, 110));
addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent evt) {
formMousePressed(evt);
}
});
addWindowListener(new WindowAdapter() {
public void windowOpened(WindowEvent evt) {
formWindowOpened(evt);
}
public void windowClosing(WindowEvent evt) {
formWindowClosing(evt);
}
});
// NOI18N
listLabel.setText(Bundle.getMessage("ProfileManagerDialog.listLabel.text"));
profiles.setModel(new ProfileListModel());
profiles.setSelectedValue(ProfileManager.getDefault().getActiveProfile(), true);
profiles.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
// NOI18N
profiles.setToolTipText(Bundle.getMessage("ProfileManagerDialog.profiles.toolTipText"));
profiles.setCellRenderer(new ProfileListCellRenderer());
profiles.setNextFocusableComponent(btnSelect);
profiles.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent evt) {
profilesKeyPressed(evt);
}
});
profiles.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent evt) {
profilesValueChanged(evt);
}
});
jScrollPane1.setViewportView(profiles);
profiles.ensureIndexIsVisible(profiles.getSelectedIndex());
// NOI18N
profiles.getAccessibleContext().setAccessibleName(Bundle.getMessage("ProfileManagerDialog.profiles.AccessibleContext.accessibleName"));
// NOI18N
btnSelect.setText(Bundle.getMessage("ProfileManagerDialog.btnSelect.text"));
btnSelect.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
btnSelectActionPerformed(evt);
}
});
// NOI18N
btnCreate.setText(Bundle.getMessage("ProfileManagerDialog.btnCreate.text"));
// NOI18N
btnCreate.setToolTipText(Bundle.getMessage("ProfilePreferencesPanel.btnCreateNewProfile.toolTipText"));
btnCreate.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
btnCreateActionPerformed(evt);
}
});
// NOI18N
btnUseExisting.setText(Bundle.getMessage("ProfileManagerDialog.btnUseExisting.text"));
btnUseExisting.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
btnUseExistingActionPerformed(evt);
}
});
// NOI18N
countDownLbl.setText(Bundle.getMessage("ProfileManagerDialog.countDownLbl.text"));
// NOI18N
countDownLbl.setToolTipText(Bundle.getMessage("ProfileManagerDialog.countDownLbl.toolTipText"));
GroupLayout layout = new GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(listLabel).addComponent(countDownLbl)).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE).addComponent(btnUseExisting).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(btnCreate).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(btnSelect)).addComponent(jScrollPane1)).addContainerGap()));
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE).addComponent(listLabel)).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(btnSelect).addComponent(btnCreate).addComponent(btnUseExisting).addComponent(countDownLbl)).addContainerGap()));
// NOI18N
listLabel.getAccessibleContext().setAccessibleName(Bundle.getMessage("ProfileManagerDialog.listLabel.text"));
pack();
}
use of javax.swing.GroupLayout in project Info-Evaluation by TechnionYP5777.
the class InteractiveFrame method initialize.
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.getContentPane().setEnabled(true);
frame.setBounds(100, 100, 600, 450);
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
txtEnterYourEvent = new JTextField();
txtEnterYourEvent.setText("Enter your event");
txtEnterYourEvent.setColumns(10);
btnAddEvent = new JButton("Add event");
table = new JTable();
table.setModel(new DefaultTableModel(new Object[][] { { "Name", "Date", "Reason" } }, new String[] { "Name", "Date", "Reason" }));
table.setBorder(new LineBorder(null));
btnSubmit = new JButton("Submit");
addEventButtonOnClick();
submitBtnOnClick();
GroupLayout groupLayout = new GroupLayout(frame.getContentPane());
groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout.createSequentialGroup().addGap(32).addGroup(groupLayout.createParallelGroup(Alignment.TRAILING).addGroup(groupLayout.createSequentialGroup().addComponent(btnSubmit).addContainerGap(485, Short.MAX_VALUE)).addGroup(groupLayout.createSequentialGroup().addGroup(groupLayout.createParallelGroup(Alignment.TRAILING).addComponent(table, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 539, Short.MAX_VALUE).addGroup(groupLayout.createSequentialGroup().addComponent(txtEnterYourEvent, GroupLayout.DEFAULT_SIZE, 416, Short.MAX_VALUE).addGap(18).addComponent(btnAddEvent))).addGap(29)))));
groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout.createSequentialGroup().addGap(35).addGroup(groupLayout.createParallelGroup(Alignment.BASELINE).addComponent(txtEnterYourEvent, GroupLayout.PREFERRED_SIZE, 31, GroupLayout.PREFERRED_SIZE).addComponent(btnAddEvent)).addGap(40).addComponent(table, GroupLayout.PREFERRED_SIZE, 248, GroupLayout.PREFERRED_SIZE).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(btnSubmit).addContainerGap(59, Short.MAX_VALUE)));
frame.getContentPane().setLayout(groupLayout);
events = new AnalyzeSources();
frame.setVisible(true);
}
use of javax.swing.GroupLayout in project Info-Evaluation by TechnionYP5777.
the class MainFrame method initialize.
/**
* Initialize the contents of the frame.
*/
private void initialize() {
/*
* this flag to change the name of search button
*/
startFlag = false;
frame = new JFrame();
frame.setTitle("Info Evaluation");
frame.setResizable(false);
final Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
frame.setBounds(0, 0, screen.width, screen.height - 1);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
try {
connector = new MySQLConnector();
} catch (final Exception e) {
JOptionPane.showMessageDialog(null, "problem with sql connector", "Error", JOptionPane.INFORMATION_MESSAGE);
}
frame.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(WindowEvent winEvt) {
try {
clearDB();
} catch (final SQLException e) {
JOptionPane.showMessageDialog(null, "problem with removing events from Database", "Error", JOptionPane.INFORMATION_MESSAGE);
}
closeConnection();
System.exit(0);
}
});
final AnalyzeSources events = new AnalyzeSources();
events.addSource(src1);
events.addSource(src2, "2015");
MySQLConnector.addEvents(events.getData());
try {
addAllKeywords(events.getData());
} catch (SQLException ¢) {
¢.printStackTrace();
}
final JMenuBar menuBar = new JMenuBar();
frame.setJMenuBar(menuBar);
mnHelp = new JMenu("Help");
menuBar.add(mnHelp);
mntmAbout = new JMenuItem("About");
mnHelp.add(mntmAbout);
popupMenu = new JPopupMenu();
mnfilter = new JMenuItem("Filter by");
mnprofile = new JMenuItem("View profile");
mnprofile.setVisible(false);
popupMenu.add(mnfilter);
popupMenu.add(mnprofile);
/*
*
* initializing the table
*
*/
// {
table = new JTable();
table.setComponentPopupMenu(popupMenu);
table.setShowVerticalLines(false);
table.setCellSelectionEnabled(true);
table.setColumnSelectionAllowed(true);
table.setBorder(new LineBorder(null));
for (int count = 1; count <= 10; ++count) table.setModel(new DefaultTableModel(new Object[][] { { "Name", "Date", "Reason" } }, new String[] { "Name", "Date", "Reason" }));
table.setBounds(30, 120, screen.width / 2 + 100, screen.height / 2);
table.setVisible(false);
js = new JScrollPane(table, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
js.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
js.setVisible(false);
js.setBounds(30, 120, screen.width / 2 + 100, screen.height / 2);
frame.getContentPane().add(js);
frame.getContentPane().add(js);
/*
* initializing the table
*
*/
inputList = new RefineTable();
inputList.addField("Date");
inputList.addField("Name");
inputList.addField("Reason");
inputList.addField("Year");
btnSearch = new JButton("Load analyze results");
searchTxt = new JTextField(10);
searchTxt.setText("Select checkBox to search");
searchTxt.setColumns(10);
searchTxt.setEditable(false);
ArrayList<String> keywords = new ArrayList<String>();
for (TableTuple t : events.getData()) {
String year = t.getDate().split("/")[2];
if (!keywords.contains(year))
keywords.add(year);
if (!keywords.contains(t.getName()))
keywords.add(t.getName());
for (String s : t.getKeyWords()) for (String key : s.split(" ")) {
if (keywords.contains(key))
continue;
keywords.add(key);
}
}
AutoComplete.setupAutoComplete(searchTxt, keywords);
chckbxName = new JCheckBox("Name");
chckbxName.setVisible(false);
chckbxDate = new JCheckBox("Date");
chckbxDate.setVisible(false);
chckbxReason = new JCheckBox("Reason");
chckbxReason.setVisible(false);
chckbxSortby = new JCheckBox("Sort by");
chckbxFilterBy = new JCheckBox("Filter by");
comboBox = new JComboBox<>();
comboBox.setVisible(false);
txtpnChooseOneFrom = new JTextPane();
txtpnChooseOneFrom.setText("Choose one from:");
txtpnChooseOneFrom.setBackground(new Color(0, 0, 0, 0));
txtpnChooseOneFrom.setVisible(false);
personalInfo = new InfoExtractor();
btnLoadAnalyzeResults = new JButton("Load analyze results");
btnLoadAnalyzeResults.setVisible(false);
/*
* add image
*/
BufferedImage myPicture;
try {
myPicture = ImageIO.read(this.getClass().getResource("images/search.png"));
lblImage = new JLabel(new ImageIcon(myPicture.getScaledInstance(220, 220, Image.SCALE_DEFAULT)));
} catch (IOException ¢) {
¢.printStackTrace();
}
chckbxSearch = new JCheckBox("");
btnAddEvents = new JButton("Add Events");
final GroupLayout groupLayout = new GroupLayout(frame.getContentPane());
groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout.createSequentialGroup().addContainerGap(881, Short.MAX_VALUE).addComponent(lblImage, GroupLayout.PREFERRED_SIZE, 232, GroupLayout.PREFERRED_SIZE).addGap(247)).addGroup(groupLayout.createSequentialGroup().addGap(30).addGroup(groupLayout.createParallelGroup(Alignment.LEADING).addGroup(groupLayout.createSequentialGroup().addComponent(btnLoadAnalyzeResults).addGap(92).addComponent(btnAddEvents, GroupLayout.PREFERRED_SIZE, 145, GroupLayout.PREFERRED_SIZE)).addGroup(groupLayout.createSequentialGroup().addComponent(chckbxSearch, GroupLayout.PREFERRED_SIZE, 29, GroupLayout.PREFERRED_SIZE).addPreferredGap(ComponentPlacement.RELATED).addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false).addComponent(searchTxt, GroupLayout.PREFERRED_SIZE, 744, GroupLayout.PREFERRED_SIZE).addGroup(groupLayout.createSequentialGroup().addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false).addGroup(groupLayout.createSequentialGroup().addComponent(chckbxName).addGap(18).addComponent(chckbxDate, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)).addGroup(groupLayout.createSequentialGroup().addComponent(chckbxSortby).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(chckbxFilterBy))).addPreferredGap(ComponentPlacement.RELATED).addComponent(chckbxReason).addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(txtpnChooseOneFrom, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))).addGap(18).addGroup(groupLayout.createParallelGroup(Alignment.LEADING).addComponent(btnSearch, GroupLayout.PREFERRED_SIZE, 224, GroupLayout.PREFERRED_SIZE).addComponent(comboBox, GroupLayout.PREFERRED_SIZE, 219, GroupLayout.PREFERRED_SIZE)))).addContainerGap(313, Short.MAX_VALUE)));
groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.TRAILING).addGroup(groupLayout.createSequentialGroup().addContainerGap().addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false).addComponent(chckbxSearch).addGroup(groupLayout.createSequentialGroup().addGroup(groupLayout.createParallelGroup(Alignment.BASELINE).addComponent(searchTxt, GroupLayout.PREFERRED_SIZE, 31, GroupLayout.PREFERRED_SIZE).addComponent(btnSearch, GroupLayout.PREFERRED_SIZE, 28, GroupLayout.PREFERRED_SIZE)).addPreferredGap(ComponentPlacement.RELATED).addGroup(groupLayout.createParallelGroup(Alignment.BASELINE).addComponent(chckbxSortby).addComponent(chckbxFilterBy)).addPreferredGap(ComponentPlacement.RELATED).addGroup(groupLayout.createParallelGroup(Alignment.LEADING).addComponent(txtpnChooseOneFrom, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addGroup(groupLayout.createParallelGroup(Alignment.BASELINE).addComponent(chckbxName).addComponent(chckbxDate).addComponent(chckbxReason)).addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))).addPreferredGap(ComponentPlacement.RELATED, 177, Short.MAX_VALUE).addComponent(lblImage, GroupLayout.PREFERRED_SIZE, 193, GroupLayout.PREFERRED_SIZE).addGap(76).addGroup(groupLayout.createParallelGroup(Alignment.BASELINE).addComponent(btnLoadAnalyzeResults, GroupLayout.PREFERRED_SIZE, 35, GroupLayout.PREFERRED_SIZE).addComponent(btnAddEvents, GroupLayout.DEFAULT_SIZE, 35, Short.MAX_VALUE)).addGap(171)));
frame.getContentPane().setLayout(groupLayout);
}
Aggregations