本文整理汇总了Java中javax.swing.JComponent.getLayout方法的典型用法代码示例。如果您正苦于以下问题:Java JComponent.getLayout方法的具体用法?Java JComponent.getLayout怎么用?Java JComponent.getLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JComponent
的用法示例。
在下文中一共展示了JComponent.getLayout方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepareRenderer
import javax.swing.JComponent; //导入方法依赖的package包/类
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());
}
}
示例2: addColorChooser
import javax.swing.JComponent; //导入方法依赖的package包/类
private void addColorChooser(JComponent c, String displayName, ColorChooser chooser) {
GridBagLayout layout = (GridBagLayout)c.getLayout();
GridBagConstraints constraints = new GridBagConstraints();
constraints.insets = new Insets(3, 3, 3, 3);
constraints.weightx = 0.0;
constraints.fill = GridBagConstraints.NONE;
constraints.anchor = GridBagConstraints.EAST;
JLabel label = new JLabel(displayName, JLabel.TRAILING);
layout.setConstraints(label, constraints);
c.add(label);
constraints.anchor = GridBagConstraints.WEST;
constraints.gridwidth = GridBagConstraints.REMAINDER;
layout.setConstraints(chooser, constraints);
c.add(chooser);
elements.add(chooser);
label.setLabelFor(chooser);
}
示例3: addFontChooser
import javax.swing.JComponent; //导入方法依赖的package包/类
private void addFontChooser(JComponent c, String displayName, FontChooser chooser) {
GridBagLayout layout = (GridBagLayout)c.getLayout();
GridBagConstraints constraints = new GridBagConstraints();
constraints.insets = new Insets(3, 3, 3, 3);
constraints.weightx = 0.0;
constraints.fill = GridBagConstraints.NONE;
constraints.anchor = GridBagConstraints.EAST;
JLabel label = new JLabel(displayName, JLabel.TRAILING);
layout.setConstraints(label, constraints);
c.add(label);
constraints.insets = new Insets(3, 3, 3, 1);
constraints.weightx = 1.0;
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.anchor = GridBagConstraints.CENTER;
layout.setConstraints(chooser.getPreview(), constraints);
c.add(chooser.getPreview());
constraints.insets = new Insets(3, 1, 3, 3);
constraints.weightx = 0.0;
constraints.fill = GridBagConstraints.NONE;
constraints.anchor = GridBagConstraints.EAST;
constraints.gridwidth = GridBagConstraints.REMAINDER;
layout.setConstraints(chooser.getButton(), constraints);
c.add(chooser.getButton());
elements.add(chooser);
label.setLabelFor(chooser.getButton());
}
示例4: addFlagsEditor
import javax.swing.JComponent; //导入方法依赖的package包/类
private void addFlagsEditor(JComponent c, String displayName) {
GridBagLayout layout = (GridBagLayout)c.getLayout();
GridBagConstraints constraints = new GridBagConstraints();
constraints.insets = new Insets(3, 3, 3, 3);
constraints.weightx = 0.0;
constraints.fill = GridBagConstraints.NONE;
constraints.anchor = GridBagConstraints.NORTHEAST;
FlagsEditor flagsEditor = new FlagsEditor();
JLabel flagsLabel = new JLabel(displayName, JLabel.TRAILING);
flagsLabel.setVerticalAlignment(SwingConstants.TOP);
layout.setConstraints(flagsLabel, constraints);
c.add(flagsLabel);
constraints.weightx = 1.0;
constraints.weighty = 1.0;
constraints.fill = GridBagConstraints.BOTH;
constraints.anchor = GridBagConstraints.CENTER;
constraints.gridwidth = GridBagConstraints.REMAINDER;
layout.setConstraints(flagsEditor, constraints);
c.add(flagsEditor);
elements.add(flagsEditor);
flagsLabel.setLabelFor(flagsEditor);
}
示例5: addSection
import javax.swing.JComponent; //导入方法依赖的package包/类
protected void addSection(JComponent section, boolean followWithSeparator)
{
// MigLayout puts in a margin, TableLayout doesn't!
String cons = section.getLayout() instanceof MigLayout ? "gap 0 0 0 0" : "gap 5 5 5 5";
add(section, cons);
if( followWithSeparator )
{
add(new JSeparator());
}
}
示例6: PopuleBarra
import javax.swing.JComponent; //导入方法依赖的package包/类
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);
}
}