use of java.awt.CardLayout in project voltdb by VoltDB.
the class ZaurusEditor method initGUI.
private void initGUI() {
// without connection there are no tables
// vAllTables is a local variable with all table names in the database
// vHoldTableNames holds the table names which have a ZaurusTableForm
Vector vAllTables = getAllTables();
if (vAllTables == null) {
return;
}
// initialize a new list for the table names which have a form in pForm
vHoldTableNames = new Vector(20);
vHoldForms = new Vector(20);
// this holds the card panel pForm for the forms in the top
// a card panel pButton below
// the both card panels form a panel which is centered in this
// and a status line in the south
this.setLayout(new BorderLayout(3, 3));
// >>> the top of this: the entry forms in pForm
// pFormButs holds in the center the forms card panel pForm and
// in the south the button card panel pButton
Panel pFormButs = new Panel();
pFormButs.setLayout(new BorderLayout(3, 3));
pForm = new Panel();
lForm = new CardLayout(2, 2);
pForm.setLayout(lForm);
// the search panel containing the list of all tables and
// the entry fields for search words in the Center
Panel pEntry = new Panel();
pEntry.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
c.insets = new Insets(3, 3, 3, 3);
c.gridwidth = 1;
c.gridheight = 1;
c.weightx = c.weighty = 1;
c.anchor = GridBagConstraints.WEST;
c.gridy = 0;
c.gridx = 0;
pEntry.add(new Label("Search table"), c);
c.gridx = 1;
// get all table names and show a drop down list of them in cTables
cTables = new Choice();
for (Enumeration e = vAllTables.elements(); e.hasMoreElements(); ) {
cTables.addItem((String) e.nextElement());
}
c.gridwidth = 2;
pEntry.add(cTables, c);
c.gridy = 1;
c.gridx = 0;
c.gridwidth = 1;
pEntry.add(new Label("Search words"), c);
c.gridx = 1;
c.gridwidth = 2;
fSearchWords = new TextField(8);
pEntry.add(fSearchWords, c);
// use search words
c.gridwidth = 1;
c.gridy = 2;
c.gridx = 0;
pEntry.add(new Label("Use search words"), c);
gAllWords = new CheckboxGroup();
Checkbox[] checkboxes = new Checkbox[2];
checkboxes[0] = new Checkbox("all", gAllWords, true);
c.gridx = 1;
pEntry.add(checkboxes[0], c);
checkboxes[1] = new Checkbox("any ", gAllWords, false);
c.gridx = 2;
pEntry.add(checkboxes[1], c);
// ignore case
c.gridy = 3;
c.gridx = 0;
pEntry.add(new Label("Ignore case"), c);
gIgnoreCase = new CheckboxGroup();
Checkbox[] checkboxes1 = new Checkbox[2];
checkboxes1[0] = new Checkbox("yes", gIgnoreCase, true);
c.gridx = 1;
pEntry.add(checkboxes1[0], c);
checkboxes1[1] = new Checkbox("no", gIgnoreCase, false);
c.gridx = 2;
pEntry.add(checkboxes1[1], c);
// Match column exactly
c.gridy = 4;
c.gridx = 0;
pEntry.add(new Label("Match whole col"), c);
gNoMatchWhole = new CheckboxGroup();
Checkbox[] checkboxes2 = new Checkbox[2];
checkboxes2[0] = new Checkbox("no", gNoMatchWhole, true);
c.gridx = 1;
pEntry.add(checkboxes2[0], c);
checkboxes2[1] = new Checkbox("yes ", gNoMatchWhole, false);
c.gridx = 2;
pEntry.add(checkboxes2[1], c);
pForm.add("search", pEntry);
pFormButs.add("Center", pForm);
// the buttons
this.initButtons();
pButton = new Panel();
lButton = new CardLayout(2, 2);
pButton.setLayout(lButton);
pButton.add("search", pSearchButs);
pButton.add("edit", pEditButs);
pButton.add("insert", pInsertButs);
pFormButs.add("South", pButton);
this.add("Center", pFormButs);
// >>> the South: status line at the bottom
Font fFont = new Font("Dialog", Font.PLAIN, 10);
ZaurusEditor.tStatus = new TextField("");
ZaurusEditor.tStatus.setEditable(false);
this.add("South", ZaurusEditor.tStatus);
}
use of java.awt.CardLayout in project voltdb by VoltDB.
the class ZaurusDatabaseManager method initGUI.
/**
* Method declaration
*
*/
private void initGUI() {
Panel pQuery = new Panel();
Panel pCommand = new Panel();
// define a Panel pCard which takes four different cards/views:
// tree of tables, command SQL text area, result window and an editor/input form
pCard = new Panel();
layoutCard = new CardLayout(2, 2);
pCard.setLayout(layoutCard);
// four buttons at the top to quickly switch between the four views
butTree = new Button("Tree");
butCommand = new Button("Command");
butResult = new Button("Result");
butEditor = new Button("Editor");
butTree.addActionListener(this);
butCommand.addActionListener(this);
butResult.addActionListener(this);
butEditor.addActionListener(this);
Panel pButtons = new Panel();
pButtons.setLayout(new GridLayout(1, 4, 8, 8));
pButtons.add(butTree);
pButtons.add(butCommand);
pButtons.add(butResult);
pButtons.add(butEditor);
pResult = new Panel();
pQuery.setLayout(new BorderLayout());
pCommand.setLayout(new BorderLayout());
pResult.setLayout(new BorderLayout());
Font fFont = new Font("Dialog", Font.PLAIN, 12);
txtCommand = new TextArea(5, 40);
txtCommand.addKeyListener(this);
txtResult = new TextArea(20, 40);
txtCommand.setFont(fFont);
txtResult.setFont(new Font("Courier", Font.PLAIN, 12));
butExecute = new Button("Execute");
butExecute.addActionListener(this);
pCommand.add("South", butExecute);
pCommand.add("Center", txtCommand);
gResult = new Grid();
setLayout(new BorderLayout());
pResult.add("Center", gResult);
tTree = new Tree();
tTree.setMinimumSize(new Dimension(200, 100));
gResult.setMinimumSize(new Dimension(200, 300));
eEditor = new ZaurusEditor();
pCard.add("tree", tTree);
pCard.add("command", pCommand);
pCard.add("result", pResult);
pCard.add("editor", eEditor);
fMain.add("Center", pCard);
fMain.add("North", pButtons);
doLayout();
fMain.pack();
}
use of java.awt.CardLayout in project EnrichmentMapApp by BaderLab.
the class MasterDetailDialogPage method createDataSetPanel.
private JPanel createDataSetPanel() {
JPanel titlePanel = createTitlePanel();
dataSetListModel = new IterableListModel<>();
dataSetList = new DataSetList(dataSetListModel);
dataSetList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
dataSetList.addListSelectionListener(e -> selectItem(dataSetList.getSelectedValue()));
JScrollPane scrollPane = new JScrollPane();
scrollPane.setViewportView(dataSetList);
dataSetDetailPanel = new JPanel(new BorderLayout());
dataSetDetailPanel.setBorder(BorderFactory.createLineBorder(UIManager.getColor("Separator.foreground")));
cardLayout = new CardLayout();
dataSetDetailPanel.setLayout(cardLayout);
// Blank page
dataSetDetailPanel.add(new EditNothingPanel(), "nothing");
// Common page
dataSetListModel.addElement(commonParams);
dataSetDetailPanel.add(commonParams.getDetailPanel().getPanel(), commonParams.id);
distinctEdgesCheckbox = new JCheckBox("Create separate edges for each dataset");
SwingUtil.makeSmall(distinctEdgesCheckbox);
JPanel checkboxPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 0, 0));
checkboxPanel.add(distinctEdgesCheckbox);
// Make the NORTH area of both panels the same size
titlePanel.doLayout();
checkboxPanel.setPreferredSize(titlePanel.getPreferredSize());
JPanel leftPanel = new JPanel(new BorderLayout());
leftPanel.add(titlePanel, BorderLayout.NORTH);
leftPanel.add(scrollPane, BorderLayout.CENTER);
JPanel rightPanel = new JPanel(new BorderLayout());
rightPanel.add(checkboxPanel, BorderLayout.NORTH);
rightPanel.add(dataSetDetailPanel, BorderLayout.CENTER);
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPanel, rightPanel);
splitPane.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
splitPane.setResizeWeight(0.3);
JPanel panel = new JPanel(new BorderLayout());
panel.add(splitPane, BorderLayout.CENTER);
return panel;
}
use of java.awt.CardLayout in project EnrichmentMapApp by BaderLab.
the class CardDialog method createBodyPanel.
private JPanel createBodyPanel() {
Callback callback = new Callback();
List<CardDialogPage> pages = params.getPages();
if (pages == null || pages.isEmpty()) {
throw new IllegalArgumentException("must be at least one page");
}
if (pages.size() == 1) {
CardDialogPage page = pages.get(0);
JPanel body = page.createBodyPanel(callback);
if (body == null) {
throw new NullPointerException("body panel is null");
}
JPanel bodyPanel = new JPanel(new BorderLayout());
bodyPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
bodyPanel.add(body, BorderLayout.CENTER);
currentPage = page;
return bodyPanel;
}
JPanel chooserPanel = createChooserPanel(pages);
CardLayout cardLayout = new CardLayout();
JPanel cards = new JPanel(cardLayout);
for (CardDialogPage page : pages) {
JPanel pagePanel = page.createBodyPanel(callback);
cards.add(pagePanel, page.getID());
}
pageChooserCombo.addActionListener(e -> {
ComboItem<CardDialogPage> selected = pageChooserCombo.getItemAt(pageChooserCombo.getSelectedIndex());
CardDialogPage page = selected.getValue();
cardLayout.show(cards, page.getID());
currentPage = page;
});
currentPage = pages.get(0);
JPanel body = new JPanel(new BorderLayout());
body.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
body.add(chooserPanel, BorderLayout.NORTH);
body.add(cards, BorderLayout.CENTER);
return body;
}
use of java.awt.CardLayout in project zaproxy by zaproxy.
the class SearchPanel method initialize.
/**
* This method initializes this
*/
private void initialize() {
resultsModel = new SearchResultsTableModel();
resultsTable = new SearchResultsTable(resultsModel);
resultsTable.setName(HTTP_MESSAGE_CONTAINER_NAME);
resultsTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent evt) {
if (!evt.getValueIsAdjusting()) {
SearchResult searchResult = resultsTable.getSelectedSearchResult();
if (searchResult == null) {
return;
}
displayMessage(resultsTable.getSelectedSearchResult());
// Get the focus back so that the arrow keys work
resultsTable.requestFocusInWindow();
}
}
});
this.setLayout(new CardLayout());
//this.setSize(474, 251);
this.setName(Constant.messages.getString("search.panel.title"));
// 'magnifying glass' icon
this.setIcon(new ImageIcon(SearchPanel.class.getResource("/resource/icon/16/049.png")));
this.add(getPanelCommand(), getPanelCommand().getName());
this.setShowByDefault(true);
}
Aggregations