本文整理匯總了Java中javax.swing.LayoutStyle類的典型用法代碼示例。如果您正苦於以下問題:Java LayoutStyle類的具體用法?Java LayoutStyle怎麽用?Java LayoutStyle使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
LayoutStyle類屬於javax.swing包,在下文中一共展示了LayoutStyle類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createCustomEditorGUI
import javax.swing.LayoutStyle; //導入依賴的package包/類
protected Component createCustomEditorGUI(Component resourcePanelGUI) {
if (resourcePanelGUI == null)
return delegateEditor.getCustomEditor();
JPanel panel = new JPanel();
Component delComp = delegateEditor.getCustomEditor();
GroupLayout layout = new GroupLayout(panel);
panel.setLayout(layout);
layout.setAutoCreateGaps(true);
layout.setHorizontalGroup(layout.createParallelGroup()
.addComponent(delComp)
.addGroup(layout.createSequentialGroup()
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(resourcePanelGUI)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)));
layout.setVerticalGroup(layout.createSequentialGroup()
.addComponent(delComp).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(resourcePanelGUI));
return panel;
}
示例2: getVerticalGroup
import javax.swing.LayoutStyle; //導入依賴的package包/類
private GroupLayout.ParallelGroup getVerticalGroup (GroupLayout layout, boolean hasPrimary, boolean hasRequired) {
GroupLayout.ParallelGroup res = layout.createParallelGroup (/* XXX huh? GroupLayout.PREFERRED_SIZE*/);
GroupLayout.SequentialGroup seq = layout.createSequentialGroup ();
if (hasPrimary) {
seq.addComponent (tpPrimaryTitle, GroupLayout.DEFAULT_SIZE, 40, 40)
.addPreferredGap (LayoutStyle.ComponentPlacement.RELATED)
.addComponent (tpPrimaryPlugins, GroupLayout.PREFERRED_SIZE, tpPrimaryPlugins.getPreferredSize ().height, GroupLayout.PREFERRED_SIZE)
.addPreferredGap (LayoutStyle.ComponentPlacement.RELATED)
.addGap (0, 30, 30);
}
if (hasRequired) {
seq.addComponent (tpDependingTitle, GroupLayout.DEFAULT_SIZE, 80, 80)
.addPreferredGap (LayoutStyle.ComponentPlacement.RELATED)
.addComponent (tpDependingPlugins, GroupLayout.PREFERRED_SIZE, tpDependingPlugins.getPreferredSize ().height, GroupLayout.PREFERRED_SIZE)
.addPreferredGap (LayoutStyle.ComponentPlacement.RELATED);
}
res.addGroup (seq);
return res;
}
示例3: init
import javax.swing.LayoutStyle; //導入依賴的package包/類
private void init() {
errorLabel.setText(" "); // NOI18N
GroupLayout containerPanelLayout = new GroupLayout(containerPanel);
containerPanel.setLayout(containerPanelLayout);
GroupLayout.ParallelGroup horizontalGroup = containerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING);
GroupLayout.SequentialGroup verticalGroup = containerPanelLayout.createSequentialGroup();
containerPanelLayout.setHorizontalGroup(horizontalGroup);
containerPanelLayout.setVerticalGroup(
containerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(verticalGroup)
);
for (CssPreprocessorUIImplementation.Options options : allOptions) {
JComponent component = options.getComponent();
Parameters.notNull("component", component); // NOI18N
horizontalGroup.addComponent(component, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE);
verticalGroup.addComponent(component, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED);
}
}
示例4: searchingPanel
import javax.swing.LayoutStyle; //導入依賴的package包/類
private static JPanel searchingPanel(JLabel progressLabel, JComponent progressComponent) {
JPanel panel = new JPanel();
progressLabel.setLabelFor(progressComponent);
javax.swing.GroupLayout layout = new GroupLayout(panel);
panel.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
.addComponent(progressLabel, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(progressComponent, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 399, Short.MAX_VALUE))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(96, 96, 96)
.addComponent(progressLabel)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(progressComponent, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addContainerGap(109, Short.MAX_VALUE))
);
return panel;
}
示例5: layoutDisplay
import javax.swing.LayoutStyle; //導入依賴的package包/類
void layoutDisplay( int clockTop )
{
displayLayout.setHorizontalGroup(
displayLayout.createParallelGroup( GroupLayout.Alignment.CENTER)
.addComponent(piePanel)
.addComponent( ((clockTop==1)?timePanel:messagePanel) )
.addComponent(datePanel)
.addComponent(((clockTop==1)?messagePanel:timePanel)));
displayLayout.setVerticalGroup(
displayLayout.createSequentialGroup()
.addComponent(piePanel)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(((clockTop==1)?timePanel:messagePanel))
.addComponent(datePanel)
.addComponent(((clockTop==1)?messagePanel:timePanel)));
displayPanel.validate();
}
示例6: setButtonPanelLayout
import javax.swing.LayoutStyle; //導入依賴的package包/類
private void setButtonPanelLayout()
{
GroupLayout buttonPanelLayout = new GroupLayout( buttonPanel );
buttonPanel.setLayout( buttonPanelLayout );
buttonPanelLayout.setHorizontalGroup( buttonPanelLayout.createParallelGroup( GroupLayout.Alignment.LEADING )
.addGroup(
GroupLayout.Alignment.TRAILING,
buttonPanelLayout.createSequentialGroup().addContainerGap( 248, Short.MAX_VALUE ).addComponent(
okButton ).addPreferredGap( LayoutStyle.ComponentPlacement.UNRELATED ).addComponent(
detailsButton ).addGap( 20, 20, 20 ) ) );
buttonPanelLayout.setVerticalGroup( buttonPanelLayout.createParallelGroup( GroupLayout.Alignment.LEADING )
.addGroup(
GroupLayout.Alignment.TRAILING,
buttonPanelLayout.createSequentialGroup().addContainerGap( GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE ).addGroup(
buttonPanelLayout.createParallelGroup( GroupLayout.Alignment.BASELINE ).addComponent(
okButton ).addComponent( detailsButton ) ).addContainerGap() ) );
}
示例7: initGUI
import javax.swing.LayoutStyle; //導入依賴的package包/類
private void initGUI() {
// Fill dropdown.
String[] items = this.classnames.keySet().toArray(new String[0]);
this.dropdown = new JComboBox<String>(items);
// Select current generator in dropdown.
for(int i = 0; i < items.length; i++) {
if (this.generator.getName().equals(items[i])) {
this.dropdown.setSelectedIndex(i);
}
}
// Create label.
JLabel dropdownLabel = new JLabel("Generator:");
dropdownLabel.setLabelFor(this.dropdown);
dropdownLabel.setHorizontalAlignment(JLabel.TRAILING);
// Initialize layout and add components to GUI.
GroupLayout layout = new GroupLayout(this.panel);
this.panel.setLayout(layout);
layout.setAutoCreateGaps(true);
layout.setAutoCreateContainerGaps(true);
layout.setHorizontalGroup(layout
.createSequentialGroup()
.addComponent(dropdownLabel)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(this.dropdown)
);
layout.setVerticalGroup(layout
.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(dropdownLabel)
.addComponent(this.dropdown)
);
}
示例8: createAttachment
import javax.swing.LayoutStyle; //導入依賴的package包/類
private void createAttachment (AttachmentInfo newAttachment) {
AttachmentPanel attachment = new AttachmentPanel(nbCallback);
attachment.setBackground(UIUtils.getSectionPanelBackground());
horizontalGroup.addComponent(attachment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE);
verticalGroup.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED);
verticalGroup.addComponent(attachment, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE);
if (noneLabel.isVisible()) {
noneLabel.setVisible(false);
switchHelper();
updateButtonText(false);
}
attachment.addPropertyChangeListener(getDeletedListener());
if (newAttachment != null) {
attachment.setAttachment(newAttachment.getFile(), newAttachment.getDescription(),
newAttachment.getContentType(), newAttachment.isPatch());
}
if(nbCallback != null) {
File f = new File(Places.getUserDirectory(), nbCallback.getLogFilePath());
if(f.exists()) {
attachment.setAttachment(f, nbCallback.getLogFileDescription(), nbCallback.getLogFileContentType(), false); // NOI18N
}
attachment.browseButton.setEnabled(false);
attachment.fileField.setEnabled(false);
attachment.fileTypeCombo.setEnabled(false);
attachment.patchChoice.setEnabled(false);
} else {
attachment.viewButton.setVisible(false);
}
newAttachments.add(attachment);
UIUtils.keepFocusedComponentVisible(attachment, parentPanel);
revalidate();
attachment.addChangeListener(getChangeListener());
attachment.fileField.requestFocus();
if (nbCallback != null) {
supp.fireChange();
}
}
示例9: createCustomEditorGUI
import javax.swing.LayoutStyle; //導入依賴的package包/類
@Override
protected Component createCustomEditorGUI(Component resourcePanelGUI) {
if (resourcePanelGUI == null && ResourceSupport.isResourceableProperty(property)) {
// not usable for full resourcing, only for internationalization
// add a NOI18N checkbox so the user can mark the property as not to be internationalized
Component customEd = delegateEditor.getCustomEditor();
JPanel panel = new JPanel();
GroupLayout layout = new GroupLayout(panel);
panel.setLayout(layout);
noI18nCheckbox = new JCheckBox();
Mnemonics.setLocalizedText(noI18nCheckbox, NbBundle.getMessage(StringEditor.class, "CTL_NOI18NCheckBox")); // NOI18N
noI18nCheckbox.getAccessibleContext().setAccessibleDescription(
NbBundle.getBundle(
StringEditor.class).getString("ACD_NOI18NCheckBox")); //NOI18N
layout.setHorizontalGroup(layout.createParallelGroup()
.addComponent(customEd)
.addGroup(layout.createSequentialGroup()
.addContainerGap().addComponent(noI18nCheckbox).addContainerGap()));
layout.setVerticalGroup(layout.createSequentialGroup()
.addComponent(customEd).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(noI18nCheckbox));
return panel;
}
else {
noI18nCheckbox = null;
return super.createCustomEditorGUI(resourcePanelGUI);
}
}
示例10: makeVerticalStrut
import javax.swing.LayoutStyle; //導入依賴的package包/類
private Component makeVerticalStrut(JComponent compA,
JComponent compB,
LayoutStyle.ComponentPlacement relatedUnrelated) {
int height = LayoutStyle.getInstance().getPreferredGap(
compA,
compB,
relatedUnrelated,
SOUTH,
this);
return Box.createVerticalStrut(height);
}
示例11: makeHorizontalStrut
import javax.swing.LayoutStyle; //導入依賴的package包/類
private Component makeHorizontalStrut(JComponent compA,
JComponent compB,
LayoutStyle.ComponentPlacement relatedUnrelated) {
int width = LayoutStyle.getInstance().getPreferredGap(
compA,
compB,
relatedUnrelated,
WEST,
this);
return Box.createHorizontalStrut(width);
}
示例12: makeVerticalStrut
import javax.swing.LayoutStyle; //導入依賴的package包/類
private static Component makeVerticalStrut(JComponent compA,
JComponent compB) {
LayoutStyle layoutStyle = LayoutStyle.getInstance();
return Box.createVerticalStrut(
layoutStyle.getPreferredGap(compA,
compB,
UNRELATED,
SOUTH,
compA.getParent()));
}
示例13: makeVerticalStrut
import javax.swing.LayoutStyle; //導入依賴的package包/類
static Component makeVerticalStrut(JComponent compA,
JComponent compB,
ComponentPlacement relatedUnrelated,
JPanel parent) {
int height = LayoutStyle.getInstance().getPreferredGap(
compA,
compB,
relatedUnrelated,
SOUTH,
parent);
return Box.createVerticalStrut(height);
}
示例14: makeHorizontalStrut
import javax.swing.LayoutStyle; //導入依賴的package包/類
static Component makeHorizontalStrut(JComponent compA,
JComponent compB,
ComponentPlacement relatedUnrelated,
JPanel parent) {
int width = LayoutStyle.getInstance().getPreferredGap(
compA,
compB,
relatedUnrelated,
WEST,
parent);
return Box.createHorizontalStrut(width);
}
示例15: layoutHeaderPanel
import javax.swing.LayoutStyle; //導入依賴的package包/類
private void layoutHeaderPanel(JPanel headerPanel, JLabel iconLabel, JLabel leftLabel, JLabel commentLabel, JLabel rightLabel, LinkButton replyButton, LinkButton mailtoButton, JLabel stateLabel) {
GroupLayout layout = new GroupLayout(headerPanel);
headerPanel.setLayout(layout);
GroupLayout.SequentialGroup hGroup = layout.createSequentialGroup()
.addComponent(iconLabel)
.addComponent(leftLabel);
if (stateLabel != null) {
hGroup.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(stateLabel);
}
hGroup.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(commentLabel,0, 0, Short.MAX_VALUE)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(rightLabel)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(replyButton);
if (mailtoButton != null) {
hGroup.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(mailtoButton);
}
layout.setHorizontalGroup(hGroup);
GroupLayout.ParallelGroup vGroup = layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(iconLabel)
.addComponent(leftLabel);
if (stateLabel != null) {
vGroup.addComponent(stateLabel);
}
vGroup.addComponent(commentLabel)
.addComponent(rightLabel)
.addComponent(replyButton);
if (mailtoButton != null) {
vGroup.addComponent(mailtoButton);
}
layout.setVerticalGroup(vGroup);
}