use of java.awt.GridLayout in project adempiere by adempiere.
the class PreviewPanel method setupPreview.
/**
* Create the preview UI components
*/
private void setupPreview() {
JRootPane rootPane = new JRootPane();
previewPanel.setLayout(new BorderLayout());
previewPanel.add(rootPane, BorderLayout.CENTER);
previewPanel.setBorder(BorderFactory.createLineBorder(AdempierePLAF.getSecondary1(), 1));
GridLayout gridLayout = new GridLayout(1, 3);
gridLayout.setHgap(4);
rootPane.getContentPane().setLayout(gridLayout);
rootPane.setGlassPane(new GlassPane());
rootPane.getGlassPane().setVisible(true);
CPanel column1 = new CPanel();
rootPane.getContentPane().add(column1);
CPanel column2 = new CPanel();
rootPane.getContentPane().add(column2);
CPanel column3 = new CPanel();
rootPane.getContentPane().add(column3);
column1.setLayout(new GridBagLayout());
JTree jtree = new JTree();
jtree.setFocusable(false);
jtree.setBorder(BorderFactory.createLineBorder(AdempierePLAF.getSecondary1(), 1));
column1.add(jtree, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 2, 2), 0, 0));
CTextField normal = new CTextField("Text Field");
normal.setFocusable(false);
column1.add(normal, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 5, 5, 2), 0, 0));
error.setBackground(true);
error.setFocusable(false);
column1.add(error, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 2), 0, 0));
column2.setLayout(new GridBagLayout());
JTable jtable = new JTable(s_data, s_columns);
JScrollPane scrollPane = new JScrollPane(jtable);
jtable.setFocusable(false);
scrollPane.setPreferredSize(jtable.getPreferredSize());
column2.add(scrollPane, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 2, 2, 2), 0, 0));
mandatory.setMandatory(true);
mandatory.setFocusable(false);
column2.add(mandatory, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 2), 0, 0));
CTextField inactive = new CTextField(s_res.getString("Inactive"));
inactive.setEnabled(false);
column2.add(inactive, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 2), 0, 0));
column3.setLayout(new GridBagLayout());
CTabbedPane tab = new CTabbedPane();
column3.add(tab, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 2, 2, 5), 0, 0));
CComboBox editable = new CComboBox(new Object[] { "Editable" });
editable.setEditable(true);
editable.setFocusable(false);
column3.add(editable, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 2), 0, 0));
CComboBox choice = new CComboBox(new Object[] { "Choice" });
choice.setEditable(false);
choice.setFocusable(false);
column3.add(choice, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 5), 0, 0));
tabPage1.setLayout(new BoxLayout(tabPage1, BoxLayout.Y_AXIS));
JRadioButton radio = new JRadioButton("Radio");
radio.setSelected(true);
radio.setMargin(new Insets(5, 5, 5, 5));
radio.setFocusable(false);
radio.setOpaque(false);
tabPage1.add(radio);
CCheckBox checkBox = new CCheckBox("Checkbox");
checkBox.setSelected(true);
checkBox.setMargin(new Insets(5, 5, 5, 5));
checkBox.setFocusable(false);
tabPage1.add(checkBox);
CLabel label = new CLabel("Label");
label.setHorizontalAlignment(JLabel.LEFT);
label.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
tabPage1.add(label);
button.setMargin(new Insets(5, 5, 5, 5));
button.setFocusable(false);
tabPage1.add(button);
tab.add(tabPage1, "tab1");
tab.add(new CPanel(), "tab2");
}
use of java.awt.GridLayout in project adempiere by adempiere.
the class VAttributeGrid method createGrid.
/**
* Create Grid
*/
private void createGrid() {
if (attributeCombo1 == null || m_setting)
// init
return;
int indexAttr1 = attributeCombo1.getSelectedIndex();
int indexAttr2 = attributeCombo2.getSelectedIndex();
if (indexAttr1 == indexAttr2) {
log.warning("Same Attribute Selected");
tabbedPane.setSelectedIndex(0);
return;
}
m_setting = true;
m_M_PriceList_Version_ID = 0;
KeyNamePair pl = (KeyNamePair) pickPriceList.getSelectedItem();
if (pl != null)
m_M_PriceList_Version_ID = pl.getKey();
m_M_Warehouse_ID = 0;
KeyNamePair wh = (KeyNamePair) pickWarehouse.getSelectedItem();
if (wh != null)
m_M_Warehouse_ID = wh.getKey();
// x dimension
int cols = 2;
MAttributeValue[] xValues = null;
if (indexAttr1 > 0)
xValues = m_attributes[indexAttr1 - 1].getMAttributeValues();
if (xValues != null) {
cols = xValues.length;
log.info("X - " + m_attributes[indexAttr1 - 1].getName() + " #" + xValues.length);
}
// y dimension
int rows = 2;
MAttributeValue[] yValues = null;
if (indexAttr2 > 0)
yValues = m_attributes[indexAttr2 - 1].getMAttributeValues();
if (yValues != null) {
rows = yValues.length;
log.info("Y - " + m_attributes[indexAttr2 - 1].getName() + " #" + yValues.length);
}
//
gridPanel.removeAll();
CPanel grid = new CPanel(new GridLayout(rows, cols, 5, 5));
gridPanel.add(modePanel, BorderLayout.NORTH);
gridPanel.add(new CScrollPane(grid), BorderLayout.CENTER);
//
log.info("Rows=" + rows + " - Cols=" + cols);
for (int row = 0; row < rows; row++) {
for (int col = 0; col < cols; col++) {
MAttributeValue xValue = null;
if (xValues != null)
xValue = xValues[col];
MAttributeValue yValue = null;
if (yValues != null)
yValue = yValues[row];
//
if (row == 0 && col == 0) {
CPanel descr = new CPanel(new GridLayout(2, 1, 0, 0));
if (xValues != null)
descr.add(new JLabel(m_attributes[indexAttr1 - 1].getName(), JLabel.TRAILING));
if (yValues != null)
descr.add(new JLabel(m_attributes[indexAttr2 - 1].getName()));
grid.add(descr);
} else if (// column labels
row == 0) {
if (xValue != null) {
grid.add(new JLabel(xValue.getName(), JLabel.TRAILING));
} else
grid.add(new JLabel());
} else if (// row labels
col == 0) {
if (yValue != null)
grid.add(new JLabel(yValue.getName()));
else
grid.add(new JLabel());
} else {
grid.add(getGridElement(xValue, yValue));
}
}
}
//
tabbedPane.setSelectedIndex(1);
m_setting = false;
m_frame.pack();
}
use of java.awt.GridLayout in project adempiere by adempiere.
the class Preference method jbInit.
/**
* Static Init.
* <pre>
* - panel
* - tabPane
* - customizePane
* - infoArea
* - fields ...
* - contextPane
* - contextList
* - contextSouthPanel
* - contextHeader
* - contextDetail
* - errorPane
* - errorScollPane
* - errorTable
* - southPanel
* </pre>
* @throws Exception
*/
void jbInit() throws Exception {
traceLabel.setRequestFocusEnabled(false);
traceLabel.setText(Msg.getMsg(Env.getCtx(), "TraceLevel", true));
traceLabel.setToolTipText(Msg.getMsg(Env.getCtx(), "TraceLevel", false));
traceFile.setText(Msg.getMsg(Env.getCtx(), "TraceFile", true));
traceFile.setToolTipText(Msg.getMsg(Env.getCtx(), "TraceFile", false));
autoCommit.setText(Msg.getMsg(Env.getCtx(), "AutoCommit", true));
autoCommit.setToolTipText(Msg.getMsg(Env.getCtx(), "AutoCommit", false));
autoNew.setText(Msg.getMsg(Env.getCtx(), "AutoNew", true));
autoNew.setToolTipText(Msg.getMsg(Env.getCtx(), "AutoNew", false));
adempiereSys.setText(Msg.getMsg(Env.getCtx(), "AdempiereSys", true));
adempiereSys.setToolTipText(Msg.getMsg(Env.getCtx(), "AdempiereSys", false));
logMigrationScript.setText(Msg.getMsg(Env.getCtx(), "LogMigrationScript", true));
logMigrationScript.setToolTipText(Msg.getMsg(Env.getCtx(), "LogMigrationScript", false));
printPreview.setText(Msg.getMsg(Env.getCtx(), "AlwaysPrintPreview", true));
printPreview.setToolTipText(Msg.getMsg(Env.getCtx(), "AlwaysPrintPreview", false));
validateConnectionOnStartup.setText(Msg.getMsg(Env.getCtx(), "ValidateConnectionOnStartup", true));
validateConnectionOnStartup.setToolTipText(Msg.getMsg(Env.getCtx(), "ValidateConnectionOnStartup", false));
singleInstancePerWindow.setText(Msg.getMsg(Env.getCtx(), "SingleInstancePerWindow", true));
singleInstancePerWindow.setToolTipText(Msg.getMsg(Env.getCtx(), "SingleInstancePerWindow", false));
openWindowMaximized.setText(Msg.getMsg(Env.getCtx(), "OpenWindowMaximized", true));
openWindowMaximized.setToolTipText(Msg.getMsg(Env.getCtx(), "OpenWindowMaximized", false));
autoLogin.setText(Msg.getMsg(Env.getCtx(), "AutoLogin", true));
autoLogin.setToolTipText(Msg.getMsg(Env.getCtx(), "AutoLogin", false));
storePassword.setText(Msg.getMsg(Env.getCtx(), "StorePassword", true));
storePassword.setToolTipText(Msg.getMsg(Env.getCtx(), "StorePassword", false));
showTrl.setText(Msg.getMsg(Env.getCtx(), "ShowTrlTab", true));
showTrl.setToolTipText(Msg.getMsg(Env.getCtx(), "ShowTrlTab", false));
showAcct.setText(Msg.getMsg(Env.getCtx(), "ShowAcctTab", true));
showAcct.setToolTipText(Msg.getMsg(Env.getCtx(), "ShowAcctTab", false));
showAdvanced.setText(Msg.getMsg(Env.getCtx(), "ShowAdvancedTab", true));
showAdvanced.setToolTipText(Msg.getMsg(Env.getCtx(), "ShowAdvancedTab", false));
connectionProfileLabel.setText(Msg.getElement(Env.getCtx(), "ConnectionProfile"));
cacheWindow.setText(Msg.getMsg(Env.getCtx(), "CacheWindow", true));
cacheWindow.setToolTipText(Msg.getMsg(Env.getCtx(), "CacheWindow", false));
lPrinter.setText(Msg.getMsg(Env.getCtx(), "Printer"));
lDate.setText(Msg.getMsg(Env.getCtx(), "Date"));
infoArea.setReadWrite(false);
// Charset:
lCharset.setText(Msg.getMsg(Env.getCtx(), "Charset", true));
lCharset.setToolTipText(Msg.getMsg(Env.getCtx(), "Charset", false));
getContentPane().add(panel);
panel.setLayout(panelLayout);
panel.add(tabPane, BorderLayout.CENTER);
// Customize
tabPane.add(customizePane, Msg.getMsg(Env.getCtx(), "Preference"));
customizePane.setLayout(customizeLayout);
customizePane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
Border insetBorder = BorderFactory.createEmptyBorder(2, 2, 2, 0);
if (MSystem.isSwingRememberPasswordAllowed()) {
CPanel loginPanel = new CPanel();
loginPanel.setBorder(BorderFactory.createTitledBorder(Msg.getMsg(Env.getCtx(), "Login")));
loginPanel.setLayout(new GridLayout(1, 2));
autoLogin.setBorder(insetBorder);
storePassword.setBorder(insetBorder);
loginPanel.add(autoLogin);
loginPanel.add(storePassword);
customizePane.add(loginPanel, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0));
}
CPanel windowPanel = new CPanel();
windowPanel.setBorder(BorderFactory.createTitledBorder(Msg.getMsg(Env.getCtx(), "Window")));
windowPanel.setLayout(new GridLayout(4, 2));
windowPanel.add(showAcct);
showAcct.setBorder(insetBorder);
windowPanel.add(showTrl);
showTrl.setBorder(insetBorder);
windowPanel.add(showAdvanced);
showAdvanced.setBorder(insetBorder);
windowPanel.add(autoCommit);
autoCommit.setBorder(insetBorder);
windowPanel.add(autoNew);
autoNew.setBorder(insetBorder);
windowPanel.add(cacheWindow);
cacheWindow.setBorder(insetBorder);
windowPanel.add(openWindowMaximized);
openWindowMaximized.setBorder(insetBorder);
windowPanel.add(singleInstancePerWindow);
singleInstancePerWindow.setBorder(insetBorder);
customizePane.add(windowPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0));
CPanel connPanel = new CPanel();
connPanel.setBorder(BorderFactory.createTitledBorder(Msg.getMsg(Env.getCtx(), "Connection")));
connPanel.setLayout(new GridBagLayout());
connPanel.add(connectionProfileLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
connPanel.add(connectionProfile, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
connPanel.add(validateConnectionOnStartup, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
customizePane.add(connPanel, new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0));
CPanel tracePanel = new CPanel();
tracePanel.setBorder(BorderFactory.createTitledBorder(Msg.getMsg(Env.getCtx(), "TraceInfo")));
tracePanel.setLayout(new GridBagLayout());
tracePanel.add(traceLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
tracePanel.add(traceLevel, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
tracePanel.add(traceFile, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
customizePane.add(tracePanel, new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0));
CPanel printPanel = new CPanel();
printPanel.setBorder(BorderFactory.createTitledBorder(Msg.getMsg(Env.getCtx(), "Printing")));
printPanel.setLayout(new GridBagLayout());
printPanel.add(lPrinter, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
printPanel.add(fPrinter, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
printPanel.add(printPreview, new GridBagConstraints(0, 1, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
customizePane.add(printPanel, new GridBagConstraints(0, 4, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0));
CPanel otherPanel = new CPanel();
otherPanel.setBorder(BorderFactory.createEmptyBorder());
otherPanel.setLayout(new GridLayout());
CPanel datePanel = new CPanel();
datePanel.setLayout(new FlowLayout());
((FlowLayout) datePanel.getLayout()).setAlignment(FlowLayout.LEFT);
datePanel.add(lDate);
datePanel.add(fDate);
otherPanel.add(datePanel);
datePanel.setBorder(insetBorder);
otherPanel.add(adempiereSys);
adempiereSys.setBorder(insetBorder);
otherPanel.add(logMigrationScript);
logMigrationScript.setBorder(insetBorder);
customizePane.add(otherPanel, new GridBagConstraints(0, 5, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0));
// Charset:
CPanel charsetPanel = new CPanel();
charsetPanel.setBorder(BorderFactory.createEmptyBorder());
charsetPanel.setLayout(new FlowLayout());
((FlowLayout) charsetPanel.getLayout()).setAlignment(FlowLayout.LEFT);
charsetPanel.add(lCharset);
charsetPanel.add(fCharset);
customizePane.add(charsetPanel, new GridBagConstraints(0, 6, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 2, 0), 0, 0));
CPanel themePanel = new CPanel();
themePanel.setLayout(new GridLayout(1, 1));
themePanel.add(plafEditor);
tabPane.add(themePanel, Msg.getMsg(Env.getCtx(), "UITheme", true));
configPanel.setLayout(new BorderLayout());
configPanel.add(infoArea, BorderLayout.CENTER);
CPanel configSouth = new CPanel();
configSouth.setLayout(new FlowLayout());
((FlowLayout) configSouth.getLayout()).setAlignment(FlowLayout.RIGHT);
configSouth.add(bRoleInfo);
configPanel.add(configSouth, BorderLayout.SOUTH);
tabPane.add(configPanel, Msg.getMsg(Env.getCtx(), "Info"));
// Info
tabPane.add(contextPane, Msg.getMsg(Env.getCtx(), "Context"));
contextPane.setLayout(icontextLayout);
contextPane.add(contextListScrollPane, BorderLayout.CENTER);
contextListScrollPane.setPreferredSize(new Dimension(200, 300));
infoList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
infoList.setBackground(AdempierePLAF.getFieldBackground_Inactive());
infoList.addListSelectionListener(this);
infoList.setFixedCellWidth(30);
contextPane.add(contextSouthPanel, BorderLayout.SOUTH);
contextSouthPanel.setLayout(contextSouthLayout);
contextSouthPanel.add(contextHeader, BorderLayout.WEST);
contextHeader.setBackground(SystemColor.info);
contextHeader.setReadWrite(false);
contextHeader.setLineWrap(true);
contextHeader.setWrapStyleWord(true);
contextHeader.setBorder(BorderFactory.createLoweredBevelBorder());
contextSouthPanel.add(contextDetail, BorderLayout.CENTER);
contextDetail.setBackground(SystemColor.info);
contextDetail.setReadWrite(false);
contextDetail.setLineWrap(true);
contextDetail.setWrapStyleWord(true);
contextDetail.setBorder(BorderFactory.createLoweredBevelBorder());
// Error Pane
errorPane.setLayout(errorLayout);
// tabPane.add(errorPane, Msg.getMsg(Env.getCtx(), "Errors"));
tabPane.add(errorPane, "Errors");
errorPane.add(errorScrollPane, BorderLayout.CENTER);
errorScrollPane.getViewport().add(errorTable, null);
//
errorPanel.add(bErrorsOnly);
errorPanel.add(bErrorReset);
errorPanel.add(bErrorEMail);
errorPanel.add(bErrorSave);
errorPane.add(errorPanel, BorderLayout.SOUTH);
// South
panel.add(southPanel, BorderLayout.SOUTH);
southPanel.setLayout(southLayout);
southPanel.add(statusBar, BorderLayout.SOUTH);
southPanel.add(confirm, BorderLayout.CENTER);
//
bRoleInfo.addActionListener(this);
confirm.addActionListener(this);
}
use of java.awt.GridLayout in project jmeter by apache.
the class Help method initHelpWindow.
/**
* @return {@link JDialog} Help window and initializes it if necessary
*/
private static JDialog initHelpWindow() {
if (helpWindow == null) {
helpWindow = new // independent frame to
EscapeDialog(// independent frame to
new Frame(), //$NON-NLS-1$
JMeterUtils.getResString("help"), false);
helpWindow.getContentPane().setLayout(new GridLayout(1, 1));
helpWindow.getContentPane().removeAll();
helpWindow.getContentPane().add(scroller);
ComponentUtil.centerComponentInWindow(helpWindow, 60);
}
return helpWindow;
}
use of java.awt.GridLayout in project jmeter by apache.
the class UserParametersGui method makeButtonPanel.
private JPanel makeButtonPanel() {
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new GridLayout(2, 2));
// $NON-NLS-1$
addParameterButton = new JButton(JMeterUtils.getResString("add_parameter"));
// $NON-NLS-1$
addUserButton = new JButton(JMeterUtils.getResString("add_user"));
// $NON-NLS-1$
deleteRowButton = new JButton(JMeterUtils.getResString("delete_parameter"));
// $NON-NLS-1$
deleteColumnButton = new JButton(JMeterUtils.getResString("delete_user"));
// $NON-NLS-1$
moveRowUpButton = new JButton(JMeterUtils.getResString("up"));
// $NON-NLS-1$
moveRowDownButton = new JButton(JMeterUtils.getResString("down"));
buttonPanel.add(addParameterButton);
buttonPanel.add(deleteRowButton);
buttonPanel.add(moveRowUpButton);
buttonPanel.add(addUserButton);
buttonPanel.add(deleteColumnButton);
buttonPanel.add(moveRowDownButton);
addParameterButton.addActionListener(new AddParamAction());
addUserButton.addActionListener(new AddUserAction());
deleteRowButton.addActionListener(new DeleteRowAction());
deleteColumnButton.addActionListener(new DeleteColumnAction());
moveRowUpButton.addActionListener(new MoveRowUpAction());
moveRowDownButton.addActionListener(new MoveRowDownAction());
return buttonPanel;
}
Aggregations