下面列出了javax.swing.JScrollPane#setPreferredSize ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public TableExample2(String URL, String driver, String user,
String passwd, String query) {
JFrame frame = new JFrame("Table");
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
JDBCAdapter dt = new JDBCAdapter(URL, driver, user, passwd);
dt.executeQuery(query);
// Create the table
JTable tableView = new JTable(dt);
JScrollPane scrollpane = new JScrollPane(tableView);
scrollpane.setPreferredSize(new Dimension(700, 300));
frame.getContentPane().add(scrollpane);
frame.pack();
frame.setVisible(true);
}
public TableExample2(String URL, String driver, String user,
String passwd, String query) {
JFrame frame = new JFrame("Table");
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
JDBCAdapter dt = new JDBCAdapter(URL, driver, user, passwd);
dt.executeQuery(query);
// Create the table
JTable tableView = new JTable(dt);
JScrollPane scrollpane = new JScrollPane(tableView);
scrollpane.setPreferredSize(new Dimension(700, 300));
frame.getContentPane().add(scrollpane);
frame.pack();
frame.setVisible(true);
}
@Override
public void mouseDragged(MouseEvent e) {
Point p = e.getPoint();
if(mousePressedInTriangle) {
inTheTriangleZone = true;
int yDiff = (mousePressedPoint.y - p.y);
newSize = new Dimension(100, sizeAtPress.height - yDiff);
JScrollPane sp = getScrollPane();
if(scrollPane != null) {
sp.getViewport().setSize(newSize);
sp.getViewport().setPreferredSize(newSize);
sp.getViewport().setMinimumSize(newSize);
sp.setSize(newSize);
sp.setPreferredSize(newSize);
sp.setMinimumSize(newSize);
}
scriptQueryPanel.setSize(scriptQueryPanelWidth, scriptQueryPanelHeight - yDiff);
scriptQueryPanel.revalidate();
scriptQueryPanel.repaint();
}
}
private void showRichErrorDialog(String msg) {
final JTextArea area = new JTextArea();
area.setFont(errorMessageFont);
//area.setPreferredSize(new Dimension(520, 180));
area.setEditable(false);
area.setText(msg);
// Make the JOptionPane resizable using the HierarchyListener
area.addHierarchyListener(new HierarchyListener() {
public void hierarchyChanged(HierarchyEvent e) {
Window window = SwingUtilities.getWindowAncestor(area);
if (window instanceof Dialog) {
Dialog dialog = (Dialog)window;
if (!dialog.isResizable()) {
dialog.setResizable(true);
}
}
}
});
JScrollPane scroller = new JScrollPane(area);
scroller.setPreferredSize(new Dimension(520, 180));
JOptionPane.showMessageDialog(Wandora.getWandora(), scroller, "Errors", JOptionPane.PLAIN_MESSAGE);
}
/**
* Initialise the on screen components.
*/
private void initComponents()
{
setLayout(new GridBagLayout());
addGridBagLayer(this, "in_sumClass", classComboBox); //$NON-NLS-1$
addGridBagLayer(this, "in_csdSpLvl", spellLevelComboBox); //$NON-NLS-1$
spellComboBox.setPrototypeDisplayValue("PrototypeDisplayValueForAVeryLongSpellName"); //$NON-NLS-1$
addGridBagLayer(this, "in_spellName", spellComboBox); //$NON-NLS-1$
addGridBagLayer(this, "in_csdVariant", variantComboBox); //$NON-NLS-1$
if (metamgicModel.getSize() > 0)
{
metamagicList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
metamagicList.setVisibleRowCount(4);
JScrollPane listScroller = new JScrollPane(metamagicList);
listScroller.setPreferredSize(new Dimension(250, 80));
addGridBagLayer(this, "in_metaFeat", listScroller); //$NON-NLS-1$
}
addGridBagLayer(this, "in_casterLvl", casterLevelComboBox); //$NON-NLS-1$
addGridBagLayer(this, "in_csdSpellType", spellTypeComboBox); //$NON-NLS-1$
setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
}
private void init(JLabel label, String[] columns, TableSorter sorter) {
tableModel = new PropertiesTableModel(columns);
tableModel.addTableModelListener(this);
if(sorter == null) {
sorter = new TableSorter(tableModel);
}
this.sorter = sorter;
table = new SortedTable(this.sorter);
table.getTableHeader().setReorderingAllowed(false);
table.setDefaultRenderer(String.class, new PropertiesTableCellRenderer());
//table.setDefaultEditor(CommitOptions.class, new CommitOptionsCellEditor());
table.getTableHeader().setReorderingAllowed(true);
table.setRowHeight(table.getRowHeight());
table.addAncestorListener(this);
component = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
component.setPreferredSize(new Dimension(340, 150));
table.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(PropertiesTable.class, "ACSD_PropertiesTable")); // NOI18N
label.setLabelFor(table);
setColumns(columns);
}
public GenealogyExample() {
super(new BorderLayout());
// Construct the panel with the toggle buttons.
JRadioButton showDescendant = new JRadioButton("Show descendants", true);
final JRadioButton showAncestor = new JRadioButton("Show ancestors");
ButtonGroup bGroup = new ButtonGroup();
bGroup.add(showDescendant);
bGroup.add(showAncestor);
showDescendant.addActionListener(this);
showAncestor.addActionListener(this);
showAncestor.setActionCommand(SHOW_ANCESTOR_CMD);
JPanel buttonPanel = new JPanel();
buttonPanel.add(showDescendant);
buttonPanel.add(showAncestor);
// Construct the tree.
tree = new GenealogyTree(getGenealogyGraph());
JScrollPane scrollPane = new JScrollPane(tree);
scrollPane.setPreferredSize(new Dimension(200, 200));
// Add everything to this panel.
add(buttonPanel, BorderLayout.PAGE_START);
add(scrollPane, BorderLayout.CENTER);
}
public void viewCircuit() {
String[] getFilename;
if (componentField.getText().trim().equals("")) {
getFilename = verifyFile.split("\\.");
} else {
getFilename = new String[1];
getFilename[0] = componentField.getText().trim();
}
String circuitFile = getFilename[0] + ".prs";
try {
if (new File(circuitFile).exists()) {
File log = new File(circuitFile);
BufferedReader input = new BufferedReader(new FileReader(log));
String line = null;
JTextArea messageArea = new JTextArea();
while ((line = input.readLine()) != null) {
messageArea.append(line);
messageArea.append(System.getProperty("line.separator"));
}
input.close();
messageArea.setLineWrap(true);
messageArea.setWrapStyleWord(true);
messageArea.setEditable(false);
JScrollPane scrolls = new JScrollPane();
scrolls.setMinimumSize(new Dimension(500, 500));
scrolls.setPreferredSize(new Dimension(500, 500));
scrolls.setViewportView(messageArea);
JOptionPane.showMessageDialog(Gui.frame, scrolls,
"Circuit View", JOptionPane.INFORMATION_MESSAGE);
} else {
JOptionPane.showMessageDialog(Gui.frame,
"No circuit view exists.", "Error",
JOptionPane.ERROR_MESSAGE);
}
} catch (Exception e1) {
JOptionPane.showMessageDialog(Gui.frame,
"Unable to view circuit.", "Error",
JOptionPane.ERROR_MESSAGE);
}
}
private void run() {
m_tabbedPanel.addTab( "Connection", m_connectionPanel);
m_tabbedPanel.addTab( "Market Data", m_mktDataPanel);
m_tabbedPanel.addTab( "Trading", m_tradingPanel);
m_tabbedPanel.addTab( "Account Info", m_acctInfoPanel);
m_tabbedPanel.addTab( "Options", m_optionsPanel);
m_tabbedPanel.addTab( "Combos", m_comboPanel);
m_tabbedPanel.addTab( "Contract Info", m_contractInfoPanel);
m_tabbedPanel.addTab( "Advisor", m_advisorPanel);
// m_tabbedPanel.addTab( "Strategy", m_stratPanel); in progress
m_msg.setEditable( false);
m_msg.setLineWrap( true);
JScrollPane msgScroll = new JScrollPane( m_msg);
msgScroll.setPreferredSize( new Dimension( 10000, 120) );
JScrollPane outLogScroll = new JScrollPane( m_outLog);
outLogScroll.setPreferredSize( new Dimension( 10000, 120) );
JScrollPane inLogScroll = new JScrollPane( m_inLog);
inLogScroll.setPreferredSize( new Dimension( 10000, 120) );
NewTabbedPanel bot = new NewTabbedPanel();
bot.addTab( "Messages", msgScroll);
bot.addTab( "Log (out)", outLogScroll);
bot.addTab( "Log (in)", inLogScroll);
m_frame.add( m_tabbedPanel);
m_frame.add( bot, BorderLayout.SOUTH);
m_frame.setSize( 1024, 768);
m_frame.setVisible( true);
m_frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE);
// make initial connection to local host, port 7496, client id 0
m_controller.connect( "127.0.0.1", 7496, 0);
}
private JScrollPane makeTable(TableModel model, Project project) {
JTable table = new Results(model, project);
// java 1.6.0 only!! //table.setAutoCreateRowSorter(true);
table.addMouseListener(new DisplayableListListener());
table.addKeyListener(kl);
JScrollPane jsp = new JScrollPane(table);
jsp.setPreferredSize(new Dimension(500, 500));
return jsp;
}
/**
* Constructor.
* @param manager the settlement construction manager.
*/
public ConstructedBuildingsPanel(ConstructionManager manager) {
// Use JPanel constructor.
super();
setLayout(new BorderLayout(0, 0));
// setBorder(new MarsPanelBorder());
JPanel titlePanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
add(titlePanel, BorderLayout.NORTH);
JLabel titleLabel = new JLabel("Constructed Buildings");
titlePanel.add(titleLabel);
// Create scroll panel for the outer table panel.
JScrollPane scrollPanel = new JScrollPane();
scrollPanel.setPreferredSize(new Dimension(200, 75));
scrollPanel.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
add(scrollPanel, BorderLayout.CENTER);
// Prepare constructed table model.
constructedTableModel = new ConstructedBuildingTableModel(manager);
// Prepare constructed table.
constructedTable = new ZebraJTable(constructedTableModel);
scrollPanel.setViewportView(constructedTable);
constructedTable.setRowSelectionAllowed(true);
constructedTable.getColumnModel().getColumn(0).setPreferredWidth(105);
constructedTable.getColumnModel().getColumn(1).setPreferredWidth(105);
constructedTable.setPreferredScrollableViewportSize(new Dimension(225, -1));
constructedTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
constructedTable.setAutoCreateRowSorter(true);
TableStyle.setTableStyle(constructedTable);
}
/** Instantiates a new legend panel. */
public LegendPanel() {
setLayout(new BorderLayout(0, 0));
scrollPane = new JScrollPane(legendImagePanel);
scrollPane.setAutoscrolls(true);
scrollPane.setPreferredSize(new Dimension(SCROLL_PANE_WIDTH, SCROLL_PANE_HEIGHT));
add(scrollPane, BorderLayout.CENTER);
}
void showExtProps() {
JExtPropsPanel comp = new JExtPropsPanel(node, key);
JScrollPane scroll = new JScrollPane(comp);
scroll.setPreferredSize(new Dimension(300,
20 + Math.min(comp.getPreferredSize().height, 300)));
JOptionPane.showMessageDialog(null,
scroll,
node.absolutePath() + "/" + key,
JOptionPane.INFORMATION_MESSAGE);
}
public RegisterContractDialog(Window owner, boolean isBuy) {
super(owner, ModalityType.APPLICATION_MODAL);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
this.isBuy = isBuy;
setTitle(tr("reg_register"));
conditions = new JTextPane();
conditions.setPreferredSize(new Dimension(240, 220));
acceptBox = new JCheckBox(tr("dlg_accept_terms"));
// The number of contracts to register
SpinnerNumberModel numModel = new SpinnerNumberModel(1, 1, 10, 1);
numOfContractsSpinner = new JSpinner(numModel);
JPanel numOfContractsPanel = new Desc(tr("reg_num_contracts"), numOfContractsSpinner);
numOfContractsSpinner.addChangeListener(this);
// Create a button
JPanel buttonPane = new JPanel(new FlowLayout(FlowLayout.RIGHT));
pin = new JPasswordField(12);
pin.addActionListener(this);
cancelButton = new JButton(tr("dlg_cancel"));
okButton = new JButton(tr("dlg_ok"));
cancelButton.addActionListener(this);
okButton.addActionListener(this);
buttonPane.add(new Desc(tr("dlg_pin"), pin));
buttonPane.add(new Desc(" ", cancelButton));
buttonPane.add(new Desc(" ", okButton));
JPanel content = (JPanel)getContentPane();
content.setBorder(new EmptyBorder(4, 4, 4, 4));
JPanel conditionsPanel = new JPanel(new BorderLayout());
conditionsPanel.setBorder(BorderFactory.createTitledBorder(tr("dlg_terms_and_conditions")));
JScrollPane scroll = new JScrollPane(conditions);
scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
scroll.setPreferredSize(conditions.getPreferredSize());
conditionsPanel.add(scroll, BorderLayout.CENTER);
conditionsPanel.add(acceptBox, BorderLayout.PAGE_END);
JPanel centerPanel = new JPanel(new BorderLayout());
centerPanel.add(conditionsPanel, BorderLayout.CENTER);
content.add(numOfContractsPanel, BorderLayout.PAGE_START);
content.add(centerPanel, BorderLayout.CENTER);
content.add(buttonPane, BorderLayout.PAGE_END);
contract = Contracts.getCompiler(isBuy ? ContractType.BUY : ContractType.SELL);
stateChanged(null);
pack();
}
public Constraints(BioModel bioModel, ModelEditor modelEditor) {
super(new BorderLayout());
this.bioModel = bioModel;
this.modelEditor = modelEditor;
Model model = bioModel.getSBMLDocument().getModel();
addConstraint = new JButton("Add Constraint");
removeConstraint = new JButton("Remove Constraint");
editConstraint = new JButton("Edit Constraint");
constraints = new JList();
ListOf<Constraint> listOfConstraints = model.getListOfConstraints();
String[] cons = new String[model.getConstraintCount()];
for (int i = 0; i < model.getConstraintCount(); i++) {
Constraint constraint = listOfConstraints.get(i);
if (!constraint.isSetMetaId()) {
String constraintId = "c0";
int cn = 0;
while (bioModel.isSIdInUse(constraintId)) {
cn++;
constraintId = "c" + cn;
}
SBMLutilities.setMetaId(constraint, constraintId);
}
cons[i] = constraint.getMetaId();
cons[i] += SBMLutilities.getDimensionString(constraint);
}
JPanel addRem = new JPanel();
addRem.add(addConstraint);
addRem.add(removeConstraint);
addRem.add(editConstraint);
addConstraint.addActionListener(this);
removeConstraint.addActionListener(this);
editConstraint.addActionListener(this);
JLabel panelLabel = new JLabel("List of Constraints:");
JScrollPane scroll = new JScrollPane();
scroll.setMinimumSize(new Dimension(260, 220));
scroll.setPreferredSize(new Dimension(276, 152));
scroll.setViewportView(constraints);
edu.utah.ece.async.ibiosim.dataModels.biomodel.util.Utility.sort(cons);
constraints.setListData(cons);
constraints.setSelectedIndex(0);
constraints.addMouseListener(this);
this.add(panelLabel, "North");
this.add(scroll, "Center");
this.add(addRem, "South");
}
public void initializeUI() {
uiDone = true;
JPanel titlePane = new JPanel(new FlowLayout(FlowLayout.CENTER));
topContentPanel.add(titlePane);
JLabel heading = new JLabel(Msg.getString("TabPanelPopulation.title"), JLabel.CENTER); //$NON-NLS-1$
heading.setFont(new Font("Serif", Font.BOLD, 16));
//heading.setForeground(new Color(102, 51, 0)); // dark brown
titlePane.add(heading);
// Prepare count spring layout panel.
WebPanel countPanel = new WebPanel(new SpringLayout());//GridLayout(3, 1, 0, 0));
// countPanel.setBorder(new MarsPanelBorder());
topContentPanel.add(countPanel);
// Create population indoor label
WebLabel populationIndoorHeader = new WebLabel(Msg.getString("TabPanelPopulation.indoor"),
WebLabel.RIGHT); // $NON-NLS-1$
countPanel.add(populationIndoorHeader);
populationIndoorCache = settlement.getIndoorPeopleCount();
populationIndoorLabel = new WebLabel(populationIndoorCache + "", WebLabel.LEFT);
countPanel.add(populationIndoorLabel);
// Create population capacity label
WebLabel populationCapacityHeader = new WebLabel(Msg.getString("TabPanelPopulation.capacity"),
WebLabel.RIGHT); // $NON-NLS-1$
countPanel.add(populationCapacityHeader);
populationCapacityCache = settlement.getPopulationCapacity();
populationCapacityLabel = new WebLabel(populationCapacityCache + "", WebLabel.RIGHT);
countPanel.add(populationCapacityLabel);
// Lay out the spring panel.
SpringUtilities.makeCompactGrid(countPanel, 2, 2, // rows, cols
25, 10, // initX, initY
10, 10); // xPad, yPad
UIManager.getDefaults().put("TitledBorder.titleColor", Color.darkGray);
Border lowerEtched = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
TitledBorder title = BorderFactory.createTitledBorder(lowerEtched, " " + Msg.getString("TabPanelPopulation.title") + " ");
// title.setTitleJustification(TitledBorder.RIGHT);
Font titleFont = UIManager.getFont("TitledBorder.font");
title.setTitleFont( titleFont.deriveFont(Font.ITALIC + Font.BOLD));
// Create spring layout population display panel
JPanel populationDisplayPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
populationDisplayPanel.setBorder(title);
topContentPanel.add(populationDisplayPanel);
// Create scroll panel for population list.
populationScrollPanel = new JScrollPane();
populationScrollPanel.setPreferredSize(new Dimension(200, 250));
populationDisplayPanel.add(populationScrollPanel);
// Create population list model
populationListModel = new PopulationListModel(settlement);
// Create population list
populationList = new JList<Person>(populationListModel);
populationList.addMouseListener(this);
populationScrollPanel.setViewportView(populationList);
// Create population monitor button
JButton monitorButton = new JButton(ImageLoader.getIcon(Msg.getString("img.monitor"))); //$NON-NLS-1$
monitorButton.setMargin(new Insets(1, 1, 1, 1));
monitorButton.addActionListener(this);
monitorButton.setToolTipText(Msg.getString("TabPanelPopulation.tooltip.monitor")); //$NON-NLS-1$
populationDisplayPanel.add(monitorButton);
}
static public void main(String[] args) {
JFrame frame = new JFrame("JListView test");
Container container = frame.getContentPane();
JListView view = new JListView(new JListViewModel(Integer.parseInt(args[0])));
JScrollPane sp = new JScrollPane(view);
sp.setPreferredSize(new Dimension(250, 80));
container.setLayout(new BoxLayout(container, BoxLayout.X_AXIS));
//container.add(view);
container.add(sp);
JButton b1 = new JButton("Add 1");
JButton b10 = new JButton("Add 10");
JButton b100 = new JButton("Add 100");
JButton b1000 = new JButton("Add 1000");
JButton b10000 = new JButton("Add 10000");
JPanel panel = new JPanel(new GridLayout(0,1));
container.add(panel);
panel.add(b1);
panel.add(b10);
panel.add(b100);
panel.add(b1000);
panel.add(b10000);
AddAction a1 = new AddAction(view, 1);
AddAction a10 = new AddAction(view, 10);
AddAction a100 = new AddAction(view, 100);
AddAction a1000 = new AddAction(view, 1000);
AddAction a10000 = new AddAction(view, 10000);
b1.addActionListener(a1);
b10.addActionListener(a10);
b100.addActionListener(a100);
b1000.addActionListener(a1000);
b10000.addActionListener(a10000);
frame.setVisible(true);
frame.setSize(new Dimension(700,700));
long before = System.currentTimeMillis();
int RUN = 1000;
int i = 0;
while(i++ < RUN) {
LoggingEvent event0 = new LoggingEvent("x", cat, Priority.ERROR,
"Message "+i, null);
Throwable t = new Exception("hello "+i);
LoggingEvent event1 = new LoggingEvent("x", cat, Priority.ERROR,
"Message "+i, t);
if(i % 10 == 0) {
event1.getThreadName();
view.add(event1);
} else {
event0.getThreadName();
view.add(event0);
}
}
long after = System.currentTimeMillis();
System.out.println("Time taken :"+ ((after-before)*1000/RUN));
}
public JScrollPane getPane() {
JScrollPane scroll = new JScrollPane(this, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scroll.setPreferredSize(dim);
return scroll;
}
@Override
protected JPanel createTablePanel(AbstractListTableModel<?> tableModel, String title)
{
/* Set up Design Table */
final JTable table = new JTable(tableModel);
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent event) {
setSelectAllowed(table.getSelectedRow() >= 0);
}
});
setWidthAsPercentages(table, tableModel.getWidths());
TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(tableModel);
table.setRowSorter(sorter);
JScrollPane tableScroller = new JScrollPane(table);
tableScroller.setPreferredSize(new Dimension(450, 200));
tableScroller.setAlignmentX(LEFT_ALIGNMENT);
JLabel tableLabel = new JLabel(title);
tableLabel.setLabelFor(table);
JPanel tablePane = new JPanel();
tablePane.setLayout(new BoxLayout(tablePane, BoxLayout.PAGE_AXIS));
tablePane.add(tableLabel);
tablePane.add(Box.createRigidArea(new Dimension(0, 5)));
tablePane.add(tableScroller);
tablePane.putClientProperty("table", table);
tablePane.putClientProperty("scroller", tableScroller);
tablePane.putClientProperty("label", tableLabel);
//If the user decide to double click on a design, open the design in SBOLDesigner.
table.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2 && table.getSelectedRow() >= 0 && !showModDefs.isSelected())
{
SBOLDocument chosenDesign = getSelection();
gui.openSBOLDesigner(filePath, fileName, chosenDesign.getRootComponentDefinitions(), chosenDesign.getDefaultURIprefix());
setVisible(false);
}
}
});
return tablePane;
}
public ResultWindow(PeakListRow peakListRow, Task searchTask) {
super("");
this.peakListRow = peakListRow;
this.searchTask = searchTask;
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setBackground(Color.white);
JPanel pnlLabelsAndList = new JPanel(new BorderLayout());
pnlLabelsAndList.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
pnlLabelsAndList.add(new JLabel("List of possible identities"), BorderLayout.NORTH);
listElementModel = new ResultTableModel();
compoundsTable = new ResultTable(listElementModel);
// Specify content position
JScrollPane listScroller = new JScrollPane(compoundsTable);
listScroller.setPreferredSize(new Dimension(1000, 450));
listScroller.setAlignmentX(LEFT_ALIGNMENT);
JPanel listPanel = new JPanel();
listPanel.setLayout(new BoxLayout(listPanel, BoxLayout.PAGE_AXIS));
listPanel.add(listScroller);
listPanel.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
pnlLabelsAndList.add(listPanel, BorderLayout.CENTER);
// Specify buttons
JPanel pnlButtons = new JPanel();
pnlButtons.setLayout(new BoxLayout(pnlButtons, BoxLayout.X_AXIS));
pnlButtons.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
GUIUtils.addButton(pnlButtons, "Add identity", null, this, "ADD");
GUIUtils.addButton(pnlButtons, "Copy SMILES string", null, this, "COPY_SMILES");
GUIUtils.addButton(pnlButtons, "Copy Formula string", null, this, "COPY_FORMULA");
browse = new JButton("Display DB links");
browse.setActionCommand("DB_LIST");
browse.addActionListener(this);
pnlButtons.add(browse);
setLayout(new BorderLayout());
setSize(500, 200);
add(pnlLabelsAndList, BorderLayout.CENTER);
add(pnlButtons, BorderLayout.SOUTH);
pack();
}