use of java.awt.Container in project languagetool by languagetool-org.
the class LanguageManagerDialog method show.
public void show() {
dialog = new JDialog(owner, true);
dialog.setTitle(messages.getString("guiLanguageManagerDialog"));
// close dialog when user presses Escape key:
// TODO: taken from ConfigurationDialog, avoid duplication:
KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
ActionListener actionListener = new ActionListener() {
@Override
@SuppressWarnings("unused")
public void actionPerformed(ActionEvent actionEvent) {
dialog.setVisible(false);
}
};
JRootPane rootPane = dialog.getRootPane();
rootPane.registerKeyboardAction(actionListener, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
Container contentPane = dialog.getContentPane();
contentPane.setLayout(new GridBagLayout());
list = new JList<>(ruleFiles.toArray(new File[ruleFiles.size()]));
GridBagConstraints cons = new GridBagConstraints();
cons.insets = new Insets(4, 4, 4, 4);
cons.gridx = 0;
cons.gridy = 0;
cons.fill = GridBagConstraints.BOTH;
cons.weightx = 2.0f;
cons.weighty = 2.0f;
contentPane.add(new JScrollPane(list), cons);
cons = new GridBagConstraints();
cons.insets = new Insets(4, 4, 4, 4);
cons.fill = GridBagConstraints.HORIZONTAL;
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new GridBagLayout());
addButton = new JButton(messages.getString("guiAddButton"));
addButton.addActionListener(this);
cons.gridx = 1;
cons.gridy = 0;
buttonPanel.add(addButton, cons);
removeButton = new JButton(messages.getString("guiRemoveButton"));
removeButton.addActionListener(this);
cons.gridx = 1;
cons.gridy = 1;
buttonPanel.add(removeButton, cons);
closeButton = new JButton(messages.getString("guiCloseButton"));
closeButton.addActionListener(this);
cons.gridx = 1;
cons.gridy = 2;
buttonPanel.add(closeButton, cons);
cons.gridx = 1;
cons.gridy = 0;
cons = new GridBagConstraints();
cons.anchor = GridBagConstraints.NORTH;
contentPane.add(buttonPanel, cons);
dialog.pack();
dialog.setSize(300, 200);
dialog.setLocationByPlatform(true);
dialog.setVisible(true);
}
use of java.awt.Container in project screenbird by adamhub.
the class JRoundBorderSB method paintBorder.
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
Graphics2D g2 = (Graphics2D) g.create();
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
int r = height - 1;
RoundRectangle2D round = new RoundRectangle2D.Float(x, y, width - 1, height - 1, r, r);
Container parent = c.getParent();
if (parent != null) {
g2.setColor(parent.getBackground());
Area corner = new Area(new Rectangle2D.Float(x, y, width, height));
corner.subtract(new Area(round));
g2.fill(corner);
}
g2.setColor(Color.lightGray);
g2.draw(round);
g2.dispose();
}
use of java.awt.Container in project pcgen by PCGen.
the class SplashScreen method initComponents.
private void initComponents() {
JComponent pane = new JPanel(new BorderLayout());
pane.setBorder(BorderFactory.createLineBorder(Color.BLACK, 3));
Component splashLabel = new JLabel(Icons.SplashPcgen_Ennie.getImageIcon());
pane.add(splashLabel, BorderLayout.NORTH);
loadingLabel.setBorder(BorderFactory.createEmptyBorder(10, 7, 10, 10));
pane.add(loadingLabel, BorderLayout.CENTER);
loadProgress.setStringPainted(true);
pane.add(loadProgress, BorderLayout.SOUTH);
Container cont = getContentPane();
cont.setLayout(new GridLayout(1, 1));
cont.add(pane);
pack();
setLocationRelativeTo(null);
}
use of java.awt.Container in project pcgen by PCGen.
the class PurchaseModeFrame method initComponents.
private void initComponents() {
purchaseScoreMinEdit = new JTextField(3);
purchaseScoreMaxEdit = new JTextField(3);
statusBar = new JLabel();
currentPurchaseMethods = new JComboBoxEx();
currentPurchaseMethods.setAutoSort(true);
purchaseMethodPointsEdit = new JTextField(4);
removeMethodButton = new JButton();
AbstractButton okButton = new JButton();
okButton.addActionListener(e -> CustomData.writePurchaseModeConfiguration());
jScrollPane1 = new JScrollPane();
getContentPane().setLayout(new GridBagLayout());
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
setTitle(PurchaseModeFrame.TITLE);
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent evt) {
exitForm();
}
});
Container jPanel1 = new JPanel();
jPanel1.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 5));
JLabel purchaseScoreMinLabel = new JLabel();
//$NON-NLS-1$
purchaseScoreMinLabel.setText(LanguageBundle.getString("in_Prefs_purchMin"));
//$NON-NLS-1$
purchaseScoreMinLabel.setToolTipText(LanguageBundle.getString("in_Prefs_purchMinTip"));
purchaseScoreMinLabel.setPreferredSize(new Dimension(140, 15));
jPanel1.add(purchaseScoreMinLabel);
purchaseScoreMinEdit.setHorizontalAlignment(SwingConstants.RIGHT);
purchaseScoreMinEdit.addActionListener(evt -> purchaseScoreMinValueActionPerformed());
purchaseScoreMinEdit.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
purchaseScoreMinValueActionPerformed();
}
});
jPanel1.add(purchaseScoreMinEdit);
AbstractButton purchaseScoreMinIncreaseButton = new JButton();
//$NON-NLS-1$
purchaseScoreMinIncreaseButton.setText(LanguageBundle.getString("in_Prefs_plus"));
//$NON-NLS-1$
purchaseScoreMinIncreaseButton.setToolTipText(LanguageBundle.getString("in_Prefs_incMin"));
purchaseScoreMinIncreaseButton.addActionListener(evt -> purchaseScoreMinIncreaseButtonActionPerformed());
jPanel1.add(purchaseScoreMinIncreaseButton);
AbstractButton purchaseScoreMinDecreaseButton = new JButton();
//$NON-NLS-1$
purchaseScoreMinDecreaseButton.setText(LanguageBundle.getString("in_Prefs_minus"));
//$NON-NLS-1$
purchaseScoreMinDecreaseButton.setToolTipText(LanguageBundle.getString("in_Prefs_decMin"));
purchaseScoreMinDecreaseButton.addActionListener(evt -> purchaseScoreMinDecreaseButtonActionPerformed());
jPanel1.add(purchaseScoreMinDecreaseButton);
GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
gridBagConstraints.weightx = 1.0;
getContentPane().add(jPanel1, gridBagConstraints);
Container jPanel2 = new JPanel();
jPanel2.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 5));
JLabel purchaseScoreMaxLabel = new JLabel();
//$NON-NLS-1$
purchaseScoreMaxLabel.setText(LanguageBundle.getString("in_Prefs_purchMax"));
//$NON-NLS-1$
purchaseScoreMaxLabel.setToolTipText(LanguageBundle.getString("in_Prefs_purchMaxTip"));
purchaseScoreMaxLabel.setPreferredSize(new Dimension(140, 15));
jPanel2.add(purchaseScoreMaxLabel);
purchaseScoreMaxEdit.setHorizontalAlignment(SwingConstants.RIGHT);
purchaseScoreMaxEdit.addActionListener(evt -> purchaseScoreMaxValueActionPerformed());
purchaseScoreMaxEdit.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
purchaseScoreMaxValueActionPerformed();
}
});
jPanel2.add(purchaseScoreMaxEdit);
AbstractButton purchaseScoreMaxIncreaseButton = new JButton();
//$NON-NLS-1$
purchaseScoreMaxIncreaseButton.setText(LanguageBundle.getString("in_Prefs_plus"));
//$NON-NLS-1$
purchaseScoreMaxIncreaseButton.setToolTipText(LanguageBundle.getString("in_Prefs_incMax"));
purchaseScoreMaxIncreaseButton.addActionListener(evt -> purchaseScoreMaxIncreaseButtonActionPerformed());
jPanel2.add(purchaseScoreMaxIncreaseButton);
AbstractButton purchaseScoreMaxDecreaseButton = new JButton();
//$NON-NLS-1$
purchaseScoreMaxDecreaseButton.setText(LanguageBundle.getString("in_Prefs_minus"));
//$NON-NLS-1$
purchaseScoreMaxDecreaseButton.setToolTipText(LanguageBundle.getString("in_Prefs_decMax"));
purchaseScoreMaxDecreaseButton.addActionListener(evt -> purchaseScoreMaxDecreaseButtonActionPerformed());
jPanel2.add(purchaseScoreMaxDecreaseButton);
GridBagConstraints bagConstraints = new GridBagConstraints();
bagConstraints.gridx = 0;
bagConstraints.gridy = 2;
bagConstraints.fill = GridBagConstraints.HORIZONTAL;
bagConstraints.anchor = GridBagConstraints.NORTHWEST;
bagConstraints.weightx = 1.0;
getContentPane().add(jPanel2, bagConstraints);
JComponent purchaseMethodPanel = new JPanel();
purchaseMethodPanel.setLayout(new GridBagLayout());
purchaseMethodPanel.setBorder(BorderFactory.createTitledBorder(//$NON-NLS-1$
LanguageBundle.getString("in_Prefs_allowPoints")));
bagConstraints = new GridBagConstraints();
bagConstraints.gridx = 0;
bagConstraints.gridy = 3;
bagConstraints.fill = GridBagConstraints.HORIZONTAL;
bagConstraints.anchor = GridBagConstraints.NORTHWEST;
bagConstraints.weightx = 1.0;
getContentPane().add(purchaseMethodPanel, bagConstraints);
Container purchaseMethodNamePanel = new JPanel();
purchaseMethodNamePanel.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 5));
JLabel savedMethodLabel = new JLabel();
//$NON-NLS-1$
savedMethodLabel.setText(LanguageBundle.getString("in_Prefs_savedMethods"));
savedMethodLabel.setPreferredSize(new Dimension(140, 15));
purchaseMethodNamePanel.add(savedMethodLabel);
purchaseMethodNamePanel.add(currentPurchaseMethods);
bagConstraints = new GridBagConstraints();
bagConstraints.gridx = 0;
bagConstraints.gridy = 0;
bagConstraints.fill = GridBagConstraints.HORIZONTAL;
bagConstraints.anchor = GridBagConstraints.NORTHWEST;
bagConstraints.weightx = 1.0;
getContentPane().add(purchaseMethodNamePanel, bagConstraints);
purchaseMethodPanel.add(purchaseMethodNamePanel, bagConstraints);
Container purchaseMethodPointsPanel = new JPanel();
purchaseMethodPointsPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 5));
JLabel methodPointsLabel = new JLabel();
//$NON-NLS-1$
methodPointsLabel.setText(LanguageBundle.getString("in_Prefs_points"));
methodPointsLabel.setPreferredSize(new Dimension(140, 15));
purchaseMethodPointsPanel.add(methodPointsLabel);
purchaseMethodPointsEdit.setHorizontalAlignment(SwingConstants.RIGHT);
purchaseMethodPointsEdit.setEditable(false);
//purchaseMethodPointsEdit.setText("10");
purchaseMethodPointsPanel.add(purchaseMethodPointsEdit);
bagConstraints = new GridBagConstraints();
bagConstraints.gridx = 0;
bagConstraints.gridy = 1;
bagConstraints.fill = GridBagConstraints.HORIZONTAL;
bagConstraints.anchor = GridBagConstraints.NORTHWEST;
bagConstraints.weightx = 1.0;
// getContentPane().add(purchaseMethodPointsPanel, gridBagConstraints);
purchaseMethodPanel.add(purchaseMethodPointsPanel, bagConstraints);
currentPurchaseMethods.setPreferredSize(new Dimension(140, 21));
currentPurchaseMethods.addItemListener(evt -> currentPurchaseMethodsActionPerformed());
Container purchaseMethodButtonPanel = new JPanel();
purchaseMethodButtonPanel.setLayout(new FlowLayout(FlowLayout.RIGHT));
AbstractButton addMethodButton = new JButton();
//$NON-NLS-1$
addMethodButton.setText(LanguageBundle.getString("in_Prefs_new"));
addMethodButton.addActionListener(evt -> addMethodButtonActionPerformed());
purchaseMethodButtonPanel.add(addMethodButton);
//$NON-NLS-1$
removeMethodButton.setText(LanguageBundle.getString("in_Prefs_remove"));
removeMethodButton.addActionListener(evt -> removeMethodButtonActionPerformed());
purchaseMethodButtonPanel.add(removeMethodButton);
bagConstraints = new GridBagConstraints();
bagConstraints.gridx = 0;
bagConstraints.gridy = 2;
bagConstraints.fill = GridBagConstraints.HORIZONTAL;
bagConstraints.anchor = GridBagConstraints.NORTHWEST;
bagConstraints.weightx = 1.0;
purchaseMethodPanel.add(purchaseMethodButtonPanel, bagConstraints);
//$NON-NLS-1$
statusBar.setText(LanguageBundle.getString("in_Prefs_setCost"));
statusBar.setBorder(new BevelBorder(BevelBorder.LOWERED));
bagConstraints = new GridBagConstraints();
bagConstraints.gridx = 0;
bagConstraints.gridy = 6;
bagConstraints.fill = GridBagConstraints.HORIZONTAL;
bagConstraints.ipadx = 1;
bagConstraints.ipady = 1;
bagConstraints.insets = new Insets(1, 1, 1, 1);
bagConstraints.anchor = GridBagConstraints.NORTHWEST;
bagConstraints.weightx = 1.0;
getContentPane().add(statusBar, bagConstraints);
Container jPanel3 = new JPanel();
jPanel3.setLayout(new FlowLayout(FlowLayout.RIGHT));
//$NON-NLS-1$
okButton.setText(LanguageBundle.getString("in_Prefs_OK"));
//$NON-NLS-1$
okButton.setToolTipText(LanguageBundle.getString("in_Prefs_OKTip"));
okButton.addActionListener(evt -> okButtonActionPerformed());
jPanel3.add(okButton);
AbstractButton resetButton = new JButton();
//$NON-NLS-1$
resetButton.setText(LanguageBundle.getString("in_Prefs_Reset"));
//$NON-NLS-1$
resetButton.setToolTipText(LanguageBundle.getString("in_Prefs_ResetTip"));
resetButton.addActionListener(evt -> resetButtonActionPerformed());
jPanel3.add(resetButton);
AbstractButton cancelButton = new JButton();
//$NON-NLS-1$
cancelButton.setText(LanguageBundle.getString("in_cancel"));
//$NON-NLS-1$
cancelButton.setToolTipText(LanguageBundle.getString("in_Prefs_CancelTip"));
cancelButton.addActionListener(evt -> cancelButtonActionPerformed());
jPanel3.add(cancelButton);
/////////////////////////////////////////////////
bagConstraints = new GridBagConstraints();
bagConstraints.gridx = 0;
bagConstraints.gridy = 5;
bagConstraints.fill = GridBagConstraints.HORIZONTAL;
bagConstraints.anchor = GridBagConstraints.EAST;
bagConstraints.weightx = 1.0;
getContentPane().add(jPanel3, bagConstraints);
jScrollPane1.setViewportBorder(new BevelBorder(BevelBorder.LOWERED));
jScrollPane1.setPreferredSize(new Dimension(100, 200));
purchaseModel = new PurchaseModel();
renewAbilityScoreCostTable();
bagConstraints = new GridBagConstraints();
bagConstraints.gridx = 0;
bagConstraints.gridy = 0;
bagConstraints.fill = GridBagConstraints.BOTH;
bagConstraints.anchor = GridBagConstraints.NORTHWEST;
bagConstraints.weightx = 1.0;
bagConstraints.weighty = 1.0;
getContentPane().add(jScrollPane1, bagConstraints);
pack();
initializeCurrentPurchaseMethods();
}
use of java.awt.Container in project pcgen by PCGen.
the class JDynamicTable method unconfigureEnclosingScrollPane.
@Override
protected void unconfigureEnclosingScrollPane() {
super.unconfigureEnclosingScrollPane();
Container p = getParent();
if (p instanceof JViewport) {
Container gp = p.getParent();
if (gp instanceof JScrollPane) {
JScrollPane scrollPane = (JScrollPane) gp;
// Make certain we are the viewPort's view and not, for
// example, the rowHeaderView of the scrollPane -
// an implementor of fixed columns might do this.
JViewport viewport = scrollPane.getViewport();
if (viewport == null || viewport.getView() != this) {
return;
}
scrollPane.setCorner(ScrollPaneConstants.UPPER_RIGHT_CORNER, null);
}
}
}
Aggregations