本文整理汇总了Java中javax.swing.UIManager.getInsets方法的典型用法代码示例。如果您正苦于以下问题:Java UIManager.getInsets方法的具体用法?Java UIManager.getInsets怎么用?Java UIManager.getInsets使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.UIManager
的用法示例。
在下文中一共展示了UIManager.getInsets方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AnnotationView
import javax.swing.UIManager; //导入方法依赖的package包/类
/** Creates a new instance of AnnotationViewBorder */
public AnnotationView(JTextComponent pane/*, List/ *<MarkProviderCreator>* / creators*/) {
this.pane = pane;
// Set the name to be able to check for this component when "errorStripeOnly" property
// is turned on for the pane in CustomizableSideBar.
setName("errorStripe");
repaintTask = WORKER.create(repaintTaskRunnable = new RepaintTask());
this.data = new AnnotationViewDataImpl(this, pane);
this.scrollBar = UIManager.getInsets("Nb.Editor.ErrorStripe.ScrollBar.Insets"); // NOI18N
FoldHierarchy fh = FoldHierarchy.get(pane);
fh.addFoldHierarchyListener(WeakListeners.create(FoldHierarchyListener.class, this, fh));
pane.addPropertyChangeListener(WeakListeners.propertyChange(this, pane));
updateForNewDocument();
addMouseListener(this);
addMouseMotionListener(this);
setOpaque(true);
setToolTipText(NbBundle.getMessage(AnnotationView.class,"TP_ErrorStripe"));
}
示例2: setViewComponent
import javax.swing.UIManager; //导入方法依赖的package包/类
private void setViewComponent( Component component) {
if (viewComponent == component) {
return;
}
if (viewComponent != null) {
desktop.remove(viewComponent);
}
viewComponent = component;
if (viewComponent != null) {
GridBagConstraints constr = new GridBagConstraints();
constr.gridx = 1;
constr.gridy = 1;
constr.fill = GridBagConstraints.BOTH;
constr.weightx = 1;
constr.weighty = 1;
constr.anchor = GridBagConstraints.CENTER;
Insets insets = UIManager.getInsets("nb.desktop.view.insets"); //NOI18N
if( null != insets )
constr.insets = insets;
desktop.add(component, constr);
}
layeredPane.revalidate();
layeredPane.repaint();
}
示例3: SlidingButton
import javax.swing.UIManager; //导入方法依赖的package包/类
/** Create a new button representing TabData from the model.
*
* @param buttonData Tab data as text, icon, tooltip etc.
* @param orientation horizontal/vertical orientation of the button
*/
public SlidingButton(TabData buttonData, int orientation) {
super(buttonData.getText(), buttonData.getIcon(), false);
// grab the text from client property
// XXX please rewrite when API is invented - see issue #55955
Component comp = buttonData.getComponent();
if (comp instanceof JComponent) {
Object slidingName = ((JComponent)comp).getClientProperty("SlidingName");
if (slidingName instanceof String) {
setText((String)slidingName);
}
}
this.orientation = orientation;
data = buttonData;
setFocusable(false);
setRolloverEnabled(true);
setIconTextGap(4);
setVerticalAlignment(SwingConstants.CENTER);
setHorizontalAlignment(SwingConstants.CENTER);
if ("Nimbus".equals(UIManager.getLookAndFeel().getID())) {
Insets insets = UIManager.getInsets("Button.contentMargins");
if (insets != null) {
setBorder(BorderFactory.createEmptyBorder(insets.top, insets.left, insets.bottom, insets.right));
} else {
setBorder(BorderFactory.createEmptyBorder(6, 14, 6, 14));
}
} else if( isAqua ) {
setBorder(BorderFactory.createEmptyBorder(4,10,4,10));
putClientProperty("JComponent.sizeVariant", "small");
setOpaque(false);
} else {
setMargin(new Insets(0,3,0,3));
}
setBorderPainted(false);
}
示例4: layoutContainer
import javax.swing.UIManager; //导入方法依赖的package包/类
@Override
public void layoutContainer(Container parent)
{
int width = parent.getWidth();
int height = parent.getHeight();
Insets insets = parent.getInsets();
Dimension nextD = preferredSize(nextButton);
Dimension previousD = preferredSize(previousButton);
int buttonsWidth = Math.max(nextD.width, previousD.width);
int editorHeight = height - (insets.top + insets.bottom);
// The arrowButtonInsets value is used instead of the JSpinner's
// insets if not null. Defining this to be (0, 0, 0, 0) causes the
// buttons to be aligned with the outer edge of the spinner's
// border, and leaving it as "null" places the buttons completely
// inside the spinner's border.
Insets buttonInsets = UIManager.getInsets("Spinner.arrowButtonInsets");
if( buttonInsets == null )
{
buttonInsets = insets;
}
/*
* Deal with the spinner's componentOrientation property.
*/
int editorX, editorWidth, buttonsX;
if( parent.getComponentOrientation().isLeftToRight() )
{
editorX = insets.left;
editorWidth = width - insets.left - buttonsWidth - buttonInsets.right;
buttonsX = width - buttonsWidth - buttonInsets.right;
}
else
{
buttonsX = buttonInsets.left;
editorX = buttonsX + buttonsWidth;
editorWidth = width - buttonInsets.left - buttonsWidth - insets.right;
}
int nextY = buttonInsets.top;
int nextHeight = (height / 2) + (height % 2) - nextY;
int previousY = buttonInsets.top + nextHeight;
int previousHeight = height - previousY - buttonInsets.bottom;
setBounds(editor, editorX, insets.top, editorWidth, editorHeight);
setBounds(nextButton, buttonsX, nextY, buttonsWidth, nextHeight);
setBounds(previousButton, buttonsX, previousY, buttonsWidth, previousHeight);
}