Java 类javax.swing.GroupLayout.Group 实例源码

项目:incubator-netbeans    文件:FormLayoutHelper.java   
public FormLayoutHelper(JPanel panel, Column... columns) {

        this.panel = panel;
        layout = new GroupLayout(panel);
        panel.setLayout(layout);

        horizontalGroup = layout.createSequentialGroup();
        verticalGroup = layout.createSequentialGroup();

        this.columns = columns;
        columnGroups = new Group[columns.length];

        for (int i = 0; i < columns.length; i++) {
            Group columnGroup = columns[i].createParallelGroup(layout);
            columnGroups[i] = columnGroup;
            horizontalGroup.addGroup(columnGroup);
        }

        layout.setHorizontalGroup(horizontalGroup);
        layout.setVerticalGroup(verticalGroup);
    }
项目:BabySteps    文件:FrameMixin.java   
/**
 * Instantiate a new GroupLayout and add it to the frame. The given components are then
 * aligned vertically in a single column.
 * 
 * @param components A variable amount of Component objects
 */
protected void singleColumnLayout (Component...components) {
    GroupLayout layout = new GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    Group horizontal = layout.createParallelGroup(GroupLayout.Alignment.CENTER);
    Group vertical = layout.createSequentialGroup();
    for(Component component : components) {
        for (Group group : new Group[] {horizontal, vertical}) {
            group.addComponent(component, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE);
        }
    }

    layout.setHorizontalGroup(layout.createSequentialGroup().addGroup(horizontal));
    layout.setVerticalGroup(vertical);
}
项目:jeveassets    文件:StockpileDialog.java   
public void add(JComponent jComponent) {
    components.add(jComponent);
    jPanel.removeAll();
    Group horizontalGroup;
    Group verticalGroup;
    if (alignment == Alignment.HORIZONTAL) {
        horizontalGroup = layout.createSequentialGroup();
        verticalGroup = layout.createParallelGroup();
    } else {
        horizontalGroup = layout.createParallelGroup();
        verticalGroup = layout.createSequentialGroup();
    }
    for (JComponent component : components) {
        horizontalGroup.addComponent(component);
        if (alignment == Alignment.HORIZONTAL) {
            verticalGroup.addComponent(component, Program.getButtonsHeight(), Program.getButtonsHeight(), Program.getButtonsHeight());
        } else {
            verticalGroup.addComponent(component);
        }
    }
    layout.setHorizontalGroup(horizontalGroup);
    layout.setVerticalGroup(verticalGroup);
}
项目:ChatProgram    文件:Changeling.java   
private Group buildSpecV(GroupLayout layout) {
    SequentialGroup specSectionV = layout.createSequentialGroup();

    specSectionV.addGap(5, 10, 15);
    for (int i = 0; i < cboSpecialty.length; i++) {
        specSectionV.addGroup(parallelPair(layout, cboSpecialty[i],
                txtSpecialty[i]));
        if (i == cboSpecialty.length - 1) {
            specSectionV.addGap(5, 10, Short.MAX_VALUE);
        } else {
            specSectionV.addGap(5, 10, 15);
        }

    }
    return specSectionV;
}
项目:ChatProgram    文件:Changeling.java   
private Group buildMeritsV(GroupLayout layout) {
    SequentialGroup contractsSectionV = layout.createSequentialGroup();

    contractsSectionV.addGap(5, 10, 15);
    for (int i = 0; i < cboMerits.length; i++) {
        contractsSectionV.addGroup(parallelPair(layout, cboMerits[i],
                parallelRadioArray(layout, rdoMerits[i])));
        if (i == rdoContracts.length - 1) {
            contractsSectionV.addGap(5, 10, Short.MAX_VALUE);
        } else {
            contractsSectionV.addGap(5, 10, 15);
        }

    }
    return contractsSectionV;
}
项目:ChatProgram    文件:Changeling.java   
private Group buildGoblinContractsV(GroupLayout layout) {
    SequentialGroup contractsSectionV = layout.createSequentialGroup();

    contractsSectionV.addGap(5, 10, 15);
    for (int i = 0; i < cboContracts.length; i++) {
        contractsSectionV.addGroup(parallelPair(layout, lblGoblin[i],
                txtGoblin[i]));
        if (i == rdoContracts.length - 1) {
            contractsSectionV.addGap(5, 10, Short.MAX_VALUE);
        } else {
            contractsSectionV.addGap(5, 10, 15);
        }

    }
    return contractsSectionV;
}
项目:ChatProgram    文件:Changeling.java   
private Group buildContractsV(GroupLayout layout) {
    SequentialGroup contractsSectionV = layout.createSequentialGroup();

    contractsSectionV.addGap(5, 10, 15);
    for (int i = 0; i < cboContracts.length; i++) {
        contractsSectionV.addGroup(parallelPair(layout, cboContracts[i],
                parallelRadioArray(layout, rdoContracts[i])));
        if (i == rdoContracts.length - 1) {
            contractsSectionV.addGap(5, 10, Short.MAX_VALUE);
        } else {
            contractsSectionV.addGap(5, 10, 15);
        }

    }
    return contractsSectionV;
}
项目:incubator-netbeans    文件:FormLayoutHelper.java   
public void addRow(int min, int pref, int max, JComponent... component) {

        Group newRowGroup = layout.createParallelGroup(
                GroupLayout.Alignment.BASELINE);

        for (int i = 0; i < component.length && i < columns.length; i++) {
            JComponent cmp = component[i];
            newRowGroup.addComponent(cmp, min, pref, max);
            columns[i].addComponent(cmp, columnGroups[i]);
        }
        verticalGroup.addGroup(newRowGroup);
    }
项目:incubator-netbeans    文件:FormLayoutHelper.java   
@Override
protected void addComponent(
        JComponent component, Group parallelColumnGroup) {

    parallelColumnGroup.addComponent(component,
            GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
            Short.MAX_VALUE);
}
项目:incubator-netbeans    文件:FormLayoutHelper.java   
@Override
protected void addComponent(
        JComponent component, Group parallelColumnGroup) {
    parallelColumnGroup.addComponent(component,
            GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
            Short.MAX_VALUE);
}
项目:ChatProgram    文件:Changeling.java   
private Group buildAttributesH(GroupLayout layout) {

        SequentialGroup statsSectionH = layout.createSequentialGroup();

        statsSectionH.addGap(10, 75, Short.MAX_VALUE);

        statsSectionH.addGroup(layout.createParallelGroup().addGroup(sequentialPair(
                layout, lblIntelligence,
                sequentialRadioArray(layout, rdoIntelligence))).addGroup(sequentialPair(
                layout, lblWits,
                sequentialRadioArray(layout, rdoWits))).addGroup(sequentialPair(
                layout, lblResolve,
                sequentialRadioArray(layout, rdoResolve))));

        statsSectionH.addGap(10, 15, 50);

        statsSectionH.addGroup(layout.createParallelGroup().addGroup(sequentialPair(
                layout, lblStrength,
                sequentialRadioArray(layout, rdoStrength))).addGroup(sequentialPair(
                layout, lblDexterity,
                sequentialRadioArray(layout, rdoDexterity))).addGroup(sequentialPair(
                layout, lblStamina,
                sequentialRadioArray(layout, rdoStamina))));

        statsSectionH.addGap(10, 15, 50);

        statsSectionH.addGroup(layout.createParallelGroup().addGroup(sequentialPair(
                layout, lblPresence,
                sequentialRadioArray(layout, rdoPresence))).addGroup(sequentialPair(
                layout, lblManipulation,
                sequentialRadioArray(layout, rdoManipulation))).addGroup(sequentialPair(
                layout, lblComposure,
                sequentialRadioArray(layout, rdoComposure))));

        statsSectionH.addGap(10, 75, Short.MAX_VALUE);

        return statsSectionH;
    }
项目:ChatProgram    文件:Changeling.java   
private Group buildAttributesV(GroupLayout layout) {
    ParallelGroup statsSectionV = layout.createParallelGroup();

    statsSectionV.addGroup(layout.createSequentialGroup().addGroup(parallelPair(
            layout, lblIntelligence,
            parallelRadioArray(layout, rdoIntelligence))).addGroup(parallelPair(
            layout, lblWits,
            parallelRadioArray(layout, rdoWits))).addGroup(parallelPair(
            layout, lblResolve,
            parallelRadioArray(layout, rdoResolve))));
    statsSectionV.addGroup(layout.createSequentialGroup().addGroup(parallelPair(
            layout, lblStrength,
            parallelRadioArray(layout, rdoStrength))).addGroup(parallelPair(
            layout, lblDexterity,
            parallelRadioArray(layout, rdoDexterity))).addGroup(parallelPair(
            layout, lblStamina,
            parallelRadioArray(layout, rdoStamina))));

    statsSectionV.addGroup(layout.createSequentialGroup().addGroup(parallelPair(
            layout, lblPresence,
            parallelRadioArray(layout, rdoPresence))).addGroup(parallelPair(
            layout, lblManipulation,
            parallelRadioArray(layout, rdoManipulation))).addGroup(parallelPair(
            layout, lblComposure,
            parallelRadioArray(layout, rdoComposure))));

    return statsSectionV;
}
项目:ChatProgram    文件:Changeling.java   
private Group buildDetailsH(GroupLayout layout) {

        SequentialGroup skillsSectionH = layout.createSequentialGroup();

        skillsSectionH.addGap(5, 15, Short.MAX_VALUE);

        skillsSectionH.addGroup(
                layout.createParallelGroup(GroupLayout.Alignment.CENTER)
                .addGroup(
                sequentialPair(layout,
                sequentialPair(layout, lblBackgroud, scrBackground),
                sequentialPair(layout, lblDescription, scrDescription)))
                .addGap(5, 15, Short.MAX_VALUE)
                .addGroup(
                sequentialPair(layout,
                sequentialPair(layout, lblAge, spnAge),
                sequentialPair(layout, lblHeight, txtHeight)))
                .addGap(5, 15, Short.MAX_VALUE)
                .addGroup(
                sequentialPair(layout,
                sequentialPair(layout, lblApparent, spnApparent),
                sequentialPair(layout, lblWeight, txtWeight)))
                .addGap(5, 15, Short.MAX_VALUE)
                .addGroup(
                sequentialPair(layout,
                sequentialPair(layout, lblHair, txtHair),
                sequentialPair(layout, lblRace, txtRace)))
                .addGap(5, 15, Short.MAX_VALUE)
                .addGroup(
                sequentialPair(layout,
                sequentialPair(layout, lblEyes, txtEyes),
                sequentialPair(layout, lblSex, txtSex))));

        skillsSectionH.addGap(5, 15, Short.MAX_VALUE);
        return skillsSectionH;
    }
项目:ChatProgram    文件:Changeling.java   
private Group buildDetailsV(GroupLayout layout) {
    ParallelGroup skillsSectionV = layout.createParallelGroup();

    skillsSectionV.addGroup(
            layout.createSequentialGroup()
            .addGap(5, 10, 15)
            .addGroup(
            parallelPair(layout,
            parallelPair(layout, lblBackgroud, scrBackground),
            (parallelPair(layout, lblDescription, scrDescription))))
            .addGap(5, 10, 15)
            .addGroup(layout.createParallelGroup()
            .addComponent(lblAge)
            .addComponent(spnAge)
            .addComponent(lblHeight)
            .addComponent(txtHeight))
            .addGap(5, 10, 15)
            .addGroup(layout.createParallelGroup()
            .addComponent(lblApparent)
            .addComponent(spnApparent)
            .addComponent(lblWeight)
            .addComponent(txtWeight))
            .addGap(5, 10, 15)
            .addGroup(layout.createParallelGroup()
            .addComponent(lblHair)
            .addComponent(txtHair)
            .addComponent(lblRace)
            .addComponent(txtRace))
            .addGap(5, 10, 15)
            .addGroup(layout.createParallelGroup()
            .addComponent(lblEyes)
            .addComponent(txtEyes)
            .addComponent(lblSex)
            .addComponent(txtSex))
            .addGap(5, 10, Short.MAX_VALUE));
    return skillsSectionV;
}
项目:ChatProgram    文件:Changeling.java   
private Group buildSpecH(GroupLayout layout) {
    ParallelGroup specSectionH = layout.createParallelGroup(
            Alignment.CENTER);
    for (int i = 0; i < cboSpecialty.length; i++) {
        specSectionH.addGroup(sequentialPair(layout, cboSpecialty[i],
                txtSpecialty[i]));
    }
    return specSectionH;
}
项目:ChatProgram    文件:Changeling.java   
private Group buildMeritsH(GroupLayout layout) {
    ParallelGroup contractsSectionH = layout.createParallelGroup(
            Alignment.CENTER);
    for (int i = 0; i < cboMerits.length; i++) {
        contractsSectionH.addGroup(sequentialPair(layout, cboMerits[i],
                sequentialRadioArray(layout, rdoMerits[i])));
    }
    return contractsSectionH;
}
项目:ChatProgram    文件:Changeling.java   
private Group buildGoblinContractsH(GroupLayout layout) {
    ParallelGroup contractsSectionH = layout.createParallelGroup(
            Alignment.CENTER);
    for (int i = 0; i < cboContracts.length; i++) {
        contractsSectionH.addGroup(sequentialPair(layout, lblGoblin[i],
                txtGoblin[i]));

    }
    return contractsSectionH;
}
项目:ChatProgram    文件:Changeling.java   
private Group buildPledgesH(GroupLayout layout) {
    ParallelGroup contractsSectionH = layout.createParallelGroup(
            Alignment.CENTER);
    contractsSectionH.addComponent(scrPledge);

    return contractsSectionH;
}
项目:ChatProgram    文件:Changeling.java   
private Group buildPledgesV(GroupLayout layout) {
    SequentialGroup contractsSectionV = layout.createSequentialGroup();

    contractsSectionV.addGap(5, 10, 15);
    contractsSectionV.addComponent(scrPledge);
    contractsSectionV.addGap(5, 10, 15);

    return contractsSectionV;
}
项目:ChatProgram    文件:Changeling.java   
private Group buildContractsH(GroupLayout layout) {
    ParallelGroup contractsSectionH = layout.createParallelGroup(
            Alignment.CENTER);
    for (int i = 0; i < cboContracts.length; i++) {
        contractsSectionH.addGroup(sequentialPair(layout, cboContracts[i],
                sequentialRadioArray(layout, rdoContracts[i])));

    }
    return contractsSectionH;
}
项目:ChatProgram    文件:Functions.java   
public static SequentialGroup sequentialPair( GroupLayout layout,
        Component label,
        Group arrayGroup ) {
    return layout.createSequentialGroup()
            .addComponent(label)
            .addGroup(arrayGroup);
}
项目:ChatProgram    文件:Functions.java   
public static SequentialGroup sequentialPair( GroupLayout layout,
        Group label,
        Group arrayGroup ) {
    return layout.createSequentialGroup()
            .addGroup(label)
            .addGroup(arrayGroup);
}
项目:ChatProgram    文件:Functions.java   
public static ParallelGroup parallelPair( GroupLayout layout,
        Component label,
        Group arrayGroup ) {
    return layout.createParallelGroup(GroupLayout.Alignment.CENTER)
            .addComponent(label)
            .addGroup(arrayGroup);
}
项目:ChatProgram    文件:Functions.java   
public static ParallelGroup parallelPair( GroupLayout layout,
        Group label,
        Group arrayGroup ) {
    return layout.createParallelGroup(GroupLayout.Alignment.CENTER)
            .addGroup(label)
            .addGroup(arrayGroup);
}
项目:incubator-netbeans    文件:FormLayoutHelper.java   
protected abstract void addComponent(
JComponent component, Group parallelColumnGroup);
项目:incubator-netbeans    文件:FormLayoutHelper.java   
@Override
protected void addComponent(
        JComponent component, Group parallelColumnGroup) {
    parallelColumnGroup.addComponent(component);
}
项目:incubator-netbeans    文件:FormLayoutHelper.java   
@Override
protected Group createParallelGroup(GroupLayout layout) {
    return layout.createParallelGroup();
}
项目:incubator-netbeans    文件:FormLayoutHelper.java   
@Override
protected Group createParallelGroup(GroupLayout layout) {
    return layout.createParallelGroup(
            GroupLayout.Alignment.LEADING, false);
}
项目:lgmplugin    文件:EnigmaSettingsHandler.java   
private JPanel makeSettings()
{
JPanel p = new JPanel();
GroupLayout layout = new GroupLayout(p);
layout.setAutoCreateContainerGaps(true);
p.setLayout(layout);

List<JPanel> panels = generateOptionPanels();

sDef = new SimpleCodeHolder(res.definitions);
sGlobLoc = new SimpleCodeHolder(res.globalLocals);
sInit = new SimpleCodeHolder(res.initialization);
sClean = new SimpleCodeHolder(res.cleanup);

bDef = new JButton(Messages.getString("EnigmaSettingsFrame.BUTTON_DEFINITIONS"),CODE_ICON); //$NON-NLS-1$
bGlobLoc = new JButton(Messages.getString("EnigmaSettingsFrame.BUTTON_GLOBAL_LOCALS"),CODE_ICON); //$NON-NLS-1$
bInit = new JButton(Messages.getString("EnigmaSettingsFrame.BUTTON_INITIALIZATION"),CODE_ICON); //$NON-NLS-1$
bClean = new JButton(Messages.getString("EnigmaSettingsFrame.BUTTON_CLEANUP"),CODE_ICON); //$NON-NLS-1$

bDef.addActionListener(this);
bGlobLoc.addActionListener(this);
bInit.addActionListener(this);
bClean.addActionListener(this);

Group gh = layout.createParallelGroup();
SequentialGroup gv = layout.createSequentialGroup();
if (panels != null) for (JPanel pp : panels)
    {
    gh.addComponent(pp);
    gv.addComponent(pp);
    }

layout.setHorizontalGroup(gh
/**/.addGroup(layout.createSequentialGroup()
/*  */.addComponent(bDef)
/*  */.addComponent(bGlobLoc))
/**/.addGroup(layout.createSequentialGroup()
/*  */.addComponent(bInit)
/*  */.addComponent(bClean)));
layout.setVerticalGroup(gv
/**/.addGroup(layout.createParallelGroup()
/*  */.addComponent(bDef)
/*  */.addComponent(bGlobLoc))
/**/.addGroup(layout.createParallelGroup()
/*  */.addComponent(bInit)
/*  */.addComponent(bClean))
/**/.addContainerGap());

return p;
}
项目:lgmplugin    文件:EnigmaSettingsHandler.java   
private JPanel makeAPI()
{
JPanel p = new JPanel();
GroupLayout layout = new GroupLayout(p);
layout.setAutoCreateContainerGaps(true);
p.setLayout(layout);

Group hg1 = layout.createParallelGroup();
Group hg2 = layout.createParallelGroup();
SequentialGroup vg = layout.createSequentialGroup();
final int pref = GroupLayout.PREFERRED_SIZE;

JComponent[] targs = initializeTargets();

for (int i = 0; i < targs.length; i++)
    {
    JLabel label = new JLabel(labels[i]);

    hg1.addComponent(label);
    hg2.addComponent(targs[i]);

    vg.addGroup(layout.createParallelGroup(Alignment.BASELINE)
    /**/.addComponent(label)
    /**/.addComponent(targs[i],pref,pref,pref));
    }

tfAuth = new JTextField(null);
taDesc = new JTextArea();
tfAuth.setEditable(false);
taDesc.setEditable(false);
taDesc.setLineWrap(true);
taDesc.setWrapStyleWord(true);

JLabel lAuth = new JLabel(Messages.getString("EnigmaSettingsFrame.LABEL_AUTHOR")); //$NON-NLS-1$
JScrollPane desc = new JScrollPane(taDesc);

layout.setHorizontalGroup(layout.createParallelGroup()
/**/.addGroup(layout.createSequentialGroup()
/*  */.addGroup(hg1)
/*  */.addPreferredGap(ComponentPlacement.RELATED)
/*  */.addGroup(hg2))
/**/.addGroup(layout.createSequentialGroup()
/*  */.addComponent(lAuth)
/*  */.addPreferredGap(ComponentPlacement.RELATED)
/*  */.addComponent(tfAuth))
/**/.addComponent(desc));
layout.setVerticalGroup(vg
/**/.addPreferredGap(ComponentPlacement.RELATED)
/**/.addGroup(layout.createParallelGroup(Alignment.BASELINE)
/*  */.addComponent(lAuth)
/*  */.addComponent(tfAuth))
/**/.addPreferredGap(ComponentPlacement.RELATED)
/**/.addComponent(desc,0,0,Integer.MAX_VALUE));

return p;
}
项目:ChatProgram    文件:Changeling.java   
private Group buildSkillsV(GroupLayout layout) {
    ParallelGroup skillsSectionV = layout.createParallelGroup(
            GroupLayout.Alignment.CENTER);

    // Mental
    skillsSectionV.addGroup(layout.createSequentialGroup().addGroup(
            parallelPair(layout, lblAcademics, parallelRadioArray(
            layout, rdoAcademics))).addGroup(parallelPair(layout,
            lblComputer, parallelRadioArray(
            layout, rdoComputer))).addGroup(parallelPair(layout, lblCrafts,
            parallelRadioArray(
            layout, rdoCrafts))).addGroup(parallelPair(layout,
            lblInvestigation,
            parallelRadioArray(
            layout, rdoInvestigation))).addGroup(parallelPair(layout,
            lblMedicine, parallelRadioArray(
            layout, rdoMedicine))).addGroup(parallelPair(layout, lblOccult,
            parallelRadioArray(
            layout, rdoOccult))).addGroup(parallelPair(layout, lblPolitics,
            parallelRadioArray(
            layout, rdoPolitics))).addGroup(parallelPair(layout, lblScience,
            parallelRadioArray(
            layout, rdoScience))));

    // Physical
    skillsSectionV.addGroup(layout.createSequentialGroup().addGroup(parallelPair(
            layout, lblAthletics,
            parallelRadioArray(
            layout, rdoAthletics))).addGroup(parallelPair(layout, lblBrawl,
            parallelRadioArray(
            layout, rdoBrawl))).addGroup(parallelPair(layout, lblDrive,
            parallelRadioArray(
            layout, rdoDrive))).addGroup(parallelPair(layout, lblFirearms,
            parallelRadioArray(
            layout, rdoFirearms))).addGroup(parallelPair(layout, lblLarceny,
            parallelRadioArray(
            layout, rdoLarceny))).addGroup(parallelPair(layout, lblStealth,
            parallelRadioArray(
            layout, rdoStealth))).addGroup(parallelPair(layout, lblSurvival,
            parallelRadioArray(
            layout, rdoSurvival))).addGroup(parallelPair(layout, lblWeaponry,
            parallelRadioArray(
            layout, rdoWeaponry))));

    // Social
    skillsSectionV.addGroup(layout.createSequentialGroup().addGroup(parallelPair(
            layout, lblAnimalKen,
            parallelRadioArray(
            layout, rdoAnimalKen))).addGroup(parallelPair(layout, lblEmpathy,
            parallelRadioArray(
            layout, rdoEmpathy))).addGroup(parallelPair(layout,
            lblExpression,
            parallelRadioArray(
            layout, rdoExpression))).addGroup(parallelPair(layout,
            lblIntimidation,
            parallelRadioArray(
            layout, rdoIntimidation))).addGroup(parallelPair(layout,
            lblPersuasion,
            parallelRadioArray(
            layout, rdoPersuasion))).addGroup(parallelPair(layout,
            lblSocialize, parallelRadioArray(
            layout, rdoSocialize))).addGroup(parallelPair(layout,
            lblStreetwise,
            parallelRadioArray(
            layout, rdoStreetwise))).addGroup(parallelPair(layout,
            lblSubterfuge,
            parallelRadioArray(
            layout, rdoSubterfuge))));

    return skillsSectionV;
}
项目:incubator-netbeans    文件:FormLayoutHelper.java   
protected abstract Group createParallelGroup(GroupLayout layout);