use of java.awt.Insets in project adempiere by adempiere.
the class CompiereTabbedPaneUI method paintContentBorder.
// paintTabBackground
/**************************************************************************
* Paint Content Border (overwriting BasicTabbedPanelUI)
* Uses Color from actual Tab (not from TabbedPane)
* @param g graphics
* @param tabPlacement tab placement
* @param selectedIndex index
*/
protected void paintContentBorder(Graphics g, int tabPlacement, int selectedIndex) {
// System.out.println("TabContentBorder " );
int width = tabPane.getWidth();
int height = tabPane.getHeight();
Insets insets = tabPane.getInsets();
int x = insets.left;
int y = insets.top;
int w = width - insets.right - insets.left;
int h = height - insets.top - insets.bottom;
switch(tabPlacement) {
case LEFT:
x += calculateTabAreaWidth(tabPlacement, runCount, maxTabWidth);
w -= (x - insets.left);
break;
case RIGHT:
w -= calculateTabAreaWidth(tabPlacement, runCount, maxTabWidth);
break;
case BOTTOM:
h -= calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight);
break;
case TOP:
default:
y += calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight);
h -= (y - insets.top);
}
// Fill region behind content area - basically a border
Component comp = null;
if (selectedIndex != -1)
comp = tabPane.getComponentAt(selectedIndex);
if (comp != null && comp instanceof JComponent) {
JComponent jc = (JComponent) comp;
CompiereColor bg = null;
try {
if (jc != null)
bg = (CompiereColor) jc.getClientProperty(CompiereLookAndFeel.BACKGROUND);
} catch (Exception e) {
System.err.println("AdempiereTabbedPaneUI - ClientProperty: " + e.getMessage());
}
if (bg == null) {
bg = new CompiereColor(jc.getBackground());
jc.putClientProperty(CompiereLookAndFeel.BACKGROUND, bg);
}
bg.paintRect(g, jc, x, y, w, h);
} else // Not a JComponent - paint flat
if (comp != null) {
g.setColor(comp.getBackground());
g.fillRect(x, y, w, h);
}
paintContentBorderTopEdge(g, tabPlacement, selectedIndex, x, y, w, h);
paintContentBorderLeftEdge(g, tabPlacement, selectedIndex, x, y, w, h);
paintContentBorderBottomEdge(g, tabPlacement, selectedIndex, x, y, w, h);
paintContentBorderRightEdge(g, tabPlacement, selectedIndex, x, y, w, h);
}
use of java.awt.Insets in project adempiere by adempiere.
the class CColumnControlButton method updateUI.
@Override
public void updateUI() {
super.updateUI();
// JW: icon LF dependent?
// Make this LAF-independent
setMargin(new Insets(1, 2, 2, 1));
getColumnControlPopup().updateUI();
}
use of java.awt.Insets 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.Insets in project adempiere by adempiere.
the class EMailDialog method jbInit.
/**
* Static Init
*/
void jbInit() throws Exception {
lFrom.setText(Msg.getMsg(Env.getCtx(), "From") + ":");
lTo.setText(Msg.getMsg(Env.getCtx(), "To") + ":");
lCc.setText(Msg.getMsg(Env.getCtx(), "Cc") + ":");
lSubject.setText(Msg.getMsg(Env.getCtx(), "Subject") + ":");
lAttachment.setText(Msg.getMsg(Env.getCtx(), "Attachment") + ":");
fFrom.setReadWrite(false);
//
mainPanel.setLayout(mainLayout);
headerPanel.setLayout(headerLayout);
mainLayout.setHgap(5);
mainLayout.setVgap(5);
fMessage.setPreferredSize(new Dimension(150, 150));
getContentPane().add(mainPanel);
mainPanel.add(headerPanel, BorderLayout.NORTH);
headerPanel.add(lFrom, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 10, 0, 5), 0, 0));
headerPanel.add(fFrom, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 10), 0, 0));
headerPanel.add(lTo, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 10, 0, 5), 0, 0));
headerPanel.add(fUser, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 10), 0, 0));
headerPanel.add(fTo, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 10), 0, 0));
headerPanel.add(lCc, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 10, 0, 5), 0, 0));
headerPanel.add(fCcUser, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 10), 0, 0));
headerPanel.add(fCc, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 10), 0, 0));
headerPanel.add(lSubject, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 10, 0, 5), 0, 0));
headerPanel.add(fSubject, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 0, 10), 1, 0));
headerPanel.add(lAttachment, new GridBagConstraints(0, 7, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 10, 0, 5), 0, 0));
headerPanel.add(fAttachment, new GridBagConstraints(1, 7, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 0, 10), 1, 0));
mainPanel.add(fMessage, BorderLayout.CENTER);
//
mainPanel.add(confirmPanel, BorderLayout.SOUTH);
this.getContentPane().add(statusBar, BorderLayout.SOUTH);
confirmPanel.addActionListener(this);
statusBar.setStatusDB(null);
}
use of java.awt.Insets in project adempiere by adempiere.
the class Attachment method staticInit.
/**
* Static setup.
* <pre>
* - northPanel
* - toolBar
* - title
* - centerPane [split]
* - graphPanel (left)
* - gifScroll - gifPanel
* - pdfViewer
* - text (right)
* - confirmPanel
* </pre>
* @throws Exception
*/
void staticInit() throws Exception {
mainPanel.setLayout(mainLayout);
mainLayout.setHgap(5);
mainLayout.setVgap(5);
this.getContentPane().add(mainPanel);
northPanel.setLayout(northLayout);
northPanel.add(toolBar, BorderLayout.CENTER);
toolBar.add(bLoad);
toolBar.add(bDelete);
toolBar.add(bSave);
toolBar.add(bOpen);
toolBar.add(cbContent);
mainPanel.add(northPanel, BorderLayout.NORTH);
//
bOpen.setEnabled(false);
bOpen.setIcon(Env.getImageIcon("Editor24.gif"));
bOpen.setMargin(new Insets(0, 2, 0, 2));
bOpen.setToolTipText(Msg.getMsg(Env.getCtx(), "Open"));
bOpen.addActionListener(this);
//
bSave.setEnabled(false);
bSave.setIcon(Env.getImageIcon("Export24.gif"));
bSave.setMargin(new Insets(0, 2, 0, 2));
bSave.setToolTipText(Msg.getMsg(Env.getCtx(), "AttachmentSave"));
bSave.addActionListener(this);
//
bLoad.setIcon(Env.getImageIcon("Import24.gif"));
bLoad.setMargin(new Insets(0, 2, 0, 2));
bLoad.setToolTipText(Msg.getMsg(Env.getCtx(), "Load"));
bLoad.addActionListener(this);
//
bDelete.setIcon(Env.getImageIcon("Delete24.gif"));
bDelete.setMargin(new Insets(0, 2, 0, 2));
bDelete.setToolTipText(Msg.getMsg(Env.getCtx(), "Delete"));
bDelete.addActionListener(this);
//
Dimension size = cbContent.getPreferredSize();
size.width = 200;
cbContent.setPreferredSize(size);
// cbContent.setToolTipText(text);
cbContent.addActionListener(this);
// Acrobat Panel is heavy
cbContent.setLightWeightPopupEnabled(false);
//
text.setBackground(AdempierePLAF.getInfoBackground());
text.setPreferredSize(new Dimension(200, 200));
//
mainPanel.add(confirmPanel, BorderLayout.SOUTH);
confirmPanel.addActionListener(this);
bDeleteAll = ConfirmPanel.createDeleteButton(true);
confirmPanel.addButton(bDeleteAll);
bDeleteAll.addActionListener(this);
//
info.setText("-");
info.setReadWrite(false);
graphPanel.add(info, BorderLayout.CENTER);
//
mainPanel.add(centerPane, BorderLayout.CENTER);
centerPane.add(graphPanel, JSplitPane.LEFT);
centerPane.add(text, JSplitPane.RIGHT);
// more to graph
centerPane.setResizeWeight(.75);
}
Aggregations