package org.Algy.dialogs;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.ListSelectionModel;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.UIManager;
import javax.swing.JScrollPane;
public class BatchRenameDialog extends JDialog {
private final JPanel contentPanel = new JPanel();
private JTable table;
/**
* Launch the application.
*/
public static void main(String[] args) {
try {
BatchRenameDialog dialog = new BatchRenameDialog();
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Create the dialog.
*/
public BatchRenameDialog() {
setTitle("Batch Renaming Dialog");
setBounds(100, 100, 703, 305);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.EAST);
JScrollPane scrollPane = new JScrollPane();
JButton btnRename = new JButton("Rename");
btnRename.setMnemonic('R');
JButton btnInsert = new JButton("Insert");
btnInsert.setMnemonic('I');
JButton btnModify = new JButton("Modify");
btnModify.setMnemonic('M');
JButton btnRemove = new JButton("Remove");
btnRemove.setMnemonic('e');
GroupLayout gl_contentPanel = new GroupLayout(contentPanel);
gl_contentPanel.setHorizontalGroup(
gl_contentPanel.createParallelGroup(Alignment.LEADING)
.addGroup(gl_contentPanel.createSequentialGroup()
.addGap(29)
.addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, 499, GroupLayout.PREFERRED_SIZE)
.addGap(18)
.addGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING, false)
.addComponent(btnRename, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnRemove, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnModify, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnInsert, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(27))
);
gl_contentPanel.setVerticalGroup(
gl_contentPanel.createParallelGroup(Alignment.LEADING)
.addGroup(gl_contentPanel.createSequentialGroup()
.addGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING, false)
.addGroup(gl_contentPanel.createSequentialGroup()
.addContainerGap()
.addComponent(btnInsert)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(btnModify)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(btnRemove)
.addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnRename, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE))
.addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, 214, GroupLayout.PREFERRED_SIZE))
.addContainerGap(21, Short.MAX_VALUE))
);
table = new JTable();
table.setModel(new DefaultTableModel(
new Object[][] {
},
new String[] {
"Sort", "Name", "Replaced Name"
}
));
table.getColumnModel().getColumn(0).setPreferredWidth(68);
table.getColumnModel().getColumn(1).setPreferredWidth(221);
table.getColumnModel().getColumn(2).setPreferredWidth(128);
scrollPane.setViewportView(table);
contentPanel.setLayout(gl_contentPanel);
{
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
{
JButton okButton = new JButton("OK");
okButton.setActionCommand("OK");
buttonPane.add(okButton);
getRootPane().setDefaultButton(okButton);
}
{
JButton cancelButton = new JButton("Cancel");
cancelButton.setActionCommand("Cancel");
buttonPane.add(cancelButton);
}
}
}
}