Java Code Examples for javax.swing.JComponent#getLayout()
The following examples show how to use
javax.swing.JComponent#getLayout() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RendererPropertyDisplayer.java From netbeans with Apache License 2.0 | 6 votes |
protected void prepareRenderer(JComponent comp) { comp.setBackground(getBackground()); comp.setForeground(getForeground()); comp.setBounds(0, 0, getWidth(), getHeight()); JComponent innermost; if ((innermost = findInnermostRenderer(comp)) instanceof JComboBox) { if (comp.getLayout() != null) { comp.getLayout().layoutContainer(comp); } } if (!isTableUI() && ((InplaceEditor) comp).supportsTextEntry()) { innermost.setBackground(PropUtils.getTextFieldBackground()); innermost.setForeground(PropUtils.getTextFieldForeground()); } }
Example 2
Source File: SizeAwareBasicOptionPaneUI.java From gcs with Mozilla Public License 2.0 | 6 votes |
@Override public Dimension getMinimumSize(JComponent c) { if (c == optionPane) { Dimension ourMin = getMinimumOptionPaneSize(); LayoutManager lm = c.getLayout(); if (lm != null) { Dimension lmSize = lm.minimumLayoutSize(c); if (ourMin != null) { return new Dimension(Math.max(lmSize.width, ourMin.width), Math.max(lmSize.height, ourMin.height)); } return lmSize; } return ourMin; } return null; }
Example 3
Source File: SeaGlassButtonUI.java From seaglass with Apache License 2.0 | 6 votes |
/** * @see javax.swing.plaf.basic.BasicButtonUI#getMinimumSize(javax.swing.JComponent) */ public Dimension getMinimumSize(JComponent c) { if (c.getComponentCount() > 0 && c.getLayout() != null) { return null; } AbstractButton b = (AbstractButton) c; SeaGlassContext ss = getContext(c); final SynthStyle style2 = ss.getStyle(); Dimension size = style2.getGraphicsUtils(ss).getMinimumSize(ss, style2.getFont(ss), b.getText(), getSizingIcon(b), b.getHorizontalAlignment(), b.getVerticalAlignment(), b.getHorizontalTextPosition(), b.getVerticalTextPosition(), b.getIconTextGap(), b.getDisplayedMnemonicIndex()); ss.dispose(); return size; }
Example 4
Source File: SeaGlassButtonUI.java From seaglass with Apache License 2.0 | 6 votes |
/** * @see javax.swing.plaf.basic.BasicButtonUI#getPreferredSize(javax.swing.JComponent) */ public Dimension getPreferredSize(JComponent c) { if (c.getComponentCount() > 0 && c.getLayout() != null) { return null; } AbstractButton b = (AbstractButton) c; SeaGlassContext ss = getContext(c); SynthStyle style2 = ss.getStyle(); SynthGraphicsUtils graphicsUtils = style2.getGraphicsUtils(ss); Dimension size = graphicsUtils.getPreferredSize(ss, style2.getFont(ss), b.getText(), getSizingIcon(b), b.getHorizontalAlignment(), b.getVerticalAlignment(), b.getHorizontalTextPosition(), b.getVerticalTextPosition(), b.getIconTextGap(), b.getDisplayedMnemonicIndex()); ss.dispose(); // Make height odd. size.height &= ~1; return size; }
Example 5
Source File: SeaGlassButtonUI.java From seaglass with Apache License 2.0 | 6 votes |
/** * @see javax.swing.plaf.basic.BasicButtonUI#getMaximumSize(javax.swing.JComponent) */ public Dimension getMaximumSize(JComponent c) { if (c.getComponentCount() > 0 && c.getLayout() != null) { return null; } AbstractButton b = (AbstractButton) c; SeaGlassContext ss = getContext(c); final SynthStyle style2 = ss.getStyle(); Dimension size = style2.getGraphicsUtils(ss).getMaximumSize(ss, style2.getFont(ss), b.getText(), getSizingIcon(b), b.getHorizontalAlignment(), b.getVerticalAlignment(), b.getHorizontalTextPosition(), b.getVerticalTextPosition(), b.getIconTextGap(), b.getDisplayedMnemonicIndex()); ss.dispose(); return size; }
Example 6
Source File: Controler.java From brModelo with GNU General Public License v3.0 | 5 votes |
public void PopuleBarra(JComponent obj) { ButtonGroup buttons = new ButtonGroup(); Barra = obj; Acao ac = new Acao(editor, "?", "Controler.interface.BarraLateral.Nothing.img", "Controler.interface.BarraLateral.Nothing.Texto", null); JToggleButton btn = arrume(new JToggleButton(ac)); buttons.add(btn); obj.add(btn); btn.setSelected(true); ac.IDX = -1; this.BtnNothing = btn; int i = 0; for (ConfigAcao ca : Lista) { if (ca.tipo == TipoConfigAcao.tpBotoes || ca.tipo == TipoConfigAcao.tpAny) { ac = new Acao(editor, ca.texto, ca.ico, ca.descricao, ca.command); ac.IDX = i++; btn = arrume(new JToggleButton(ac)); buttons.add(btn); //obj.add(btn); listaBotoes.put(ca.command, btn); } } menuComandos c = menuComandos.cmdDel; String str = "Controler.comandos." + c.toString().substring(3).toLowerCase(); ac = new Acao(editor, Editor.fromConfiguracao.getValor(str + ".descricao"), str + ".img", str + ".descricao", c.toString()); ListaDeAcoesEditaveis.add(ac); ac.normal = false; JButton btn2 = new JButton(ac); btn2.setHideActionText(true); btn2.setFocusable(false); btn2.setPreferredSize(new Dimension(40, 40)); obj.add(btn2); LayoutManager la = obj.getLayout(); if (la instanceof GridLayout) { ((GridLayout) la).setRows(i + 2); } }
Example 7
Source File: AnimatedLayout.java From pumpernickel with MIT License | 5 votes |
public void propertyChange(PropertyChangeEvent evt) { Component c = (JComponent) evt.getSource(); JComponent parent = (JComponent) c.getParent(); if (parent != null) { LayoutManager layout = parent.getLayout(); if (layout == ClientProperty.this) { layout.layoutContainer(parent); } else { c.removePropertyChangeListener(PROPERTY_DESTINATION, this); } } }