本文整理汇总了Java中javax.swing.plaf.DimensionUIResource类的典型用法代码示例。如果您正苦于以下问题:Java DimensionUIResource类的具体用法?Java DimensionUIResource怎么用?Java DimensionUIResource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DimensionUIResource类属于javax.swing.plaf包,在下文中一共展示了DimensionUIResource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: register
import javax.swing.plaf.DimensionUIResource; //导入依赖的package包/类
public void register(ConverterRegistry registry) {
registry.addConverter(Dimension.class, String.class, this);
registry.addConverter(String.class, Dimension.class, this);
registry.addConverter(DimensionUIResource.class, String.class, this);
registry.addConverter(Insets.class, String.class, this);
registry.addConverter(String.class, Insets.class, this);
registry.addConverter(InsetsUIResource.class, String.class, this);
registry.addConverter(Point.class, String.class, this);
registry.addConverter(String.class, Point.class, this);
registry.addConverter(Rectangle.class, String.class, this);
registry.addConverter(String.class, Rectangle.class, this);
registry.addConverter(Font.class, String.class, this);
registry.addConverter(FontUIResource.class, String.class, this);
}
示例2: init
import javax.swing.plaf.DimensionUIResource; //导入依赖的package包/类
public static void init(UIDefaults d)
{
d.put("ScrollBarUI", AgScrollBarUI.class.getName());
d.put("ScrollBar.minimumThumbSize", new DimensionUIResource(10, 10));
d.put("ScrollBar.maximumThumbSize", new DimensionUIResource(4096, 4096));
d.put("ScrollBar.border", BORDER);
d.put("ScrollBar.track", ThemeColor.shadow(ThemeKey.TEXT_BG, 0.05));
d.put("ScrollBar.background", Theme.TEXT_BG);
d.put("ScrollBar.foreground", Theme.TEXT_FG);
//thumbHighlightColor = UIManager.getColor("ScrollBar.thumbHighlight");
//thumbLightShadowColor = UIManager.getColor("ScrollBar.thumbShadow");
//thumbDarkShadowColor = UIManager.getColor("ScrollBar.thumbDarkShadow");
//thumbColor = UIManager.getColor("ScrollBar.thumb");
//trackColor = UIManager.getColor("ScrollBar.track");
//trackHighlightColor = UIManager.getColor("ScrollBar.trackHighlight");
}
示例3: register
import javax.swing.plaf.DimensionUIResource; //导入依赖的package包/类
public void register(ConverterRegistry registry) {
registry.addConverter(Dimension.class, String.class, this);
registry.addConverter(String.class, Dimension.class, this);
registry.addConverter(DimensionUIResource.class, String.class, this);
registry.addConverter(Insets.class, String.class, this);
registry.addConverter(String.class, Insets.class, this);
registry.addConverter(InsetsUIResource.class, String.class, this);
registry.addConverter(Point.class, String.class, this);
registry.addConverter(String.class, Point.class, this);
registry.addConverter(Rectangle.class, String.class, this);
registry.addConverter(String.class, Rectangle.class, this);
registry.addConverter(Font.class, String.class, this);
registry.addConverter(FontUIResource.class, String.class, this);
}
示例4: register
import javax.swing.plaf.DimensionUIResource; //导入依赖的package包/类
@Override
public void register(Registry registry) {
registry.addConverter(Dimension.class, String.class, this);
registry.addConverter(String.class, Dimension.class, this);
registry.addConverter(DimensionUIResource.class, String.class, this);
registry.addConverter(Insets.class, String.class, this);
registry.addConverter(String.class, Insets.class, this);
registry.addConverter(InsetsUIResource.class, String.class, this);
registry.addConverter(Point.class, String.class, this);
registry.addConverter(String.class, Point.class, this);
registry.addConverter(Rectangle.class, String.class, this);
registry.addConverter(String.class, Rectangle.class, this);
registry.addConverter(Font.class, String.class, this);
registry.addConverter(FontUIResource.class, String.class, this);
}
示例5: getUIDefaults
import javax.swing.plaf.DimensionUIResource; //导入依赖的package包/类
public static final Object[] getUIDefaults()
{
return new Object[] {
//
// Notifications settings
NOTIFICATIONS_MaxDisplayed, NOTIFICATIONS_MaxDisplayed_Default
, NOTIFICATIONS_AutoFadeAwayTimeMillis, NOTIFICATIONS_AutoFadeAwayTimeMillis_Default
, NOTIFICATIONS_BottomGap, NOTIFICATIONS_BottomGap_Default
//
// Item settings
, ITEM_BackgroundColor, AdempierePLAF.createActiveValueProxy(AdempiereLookAndFeel.MANDATORY_BG_KEY, Color.WHITE) // same as mandatory background color
, ITEM_Border, new BorderUIResource(BorderFactory.createLineBorder(Color.GRAY, 1))
, ITEM_SummaryText_Font, new FontUIResource("Serif", Font.BOLD, 12)
, ITEM_DetailText_Font, new FontUIResource("Serif", Font.PLAIN, 12)
, ITEM_TextColor, null
, ITEM_MinimumSize, new DimensionUIResource(230, 45)
, ITEM_MaximumSize, null
//
// Button settings (i.e. the close button)
, ITEM_Button_Insets, new InsetsUIResource(1, 4, 1, 4)
, ITEM_Button_Size, 20
, ITEM_Button_Border, new BorderUIResource(BorderFactory.createEmptyBorder())
};
}
示例6: initComponent
import javax.swing.plaf.DimensionUIResource; //导入依赖的package包/类
private void initComponent(Image imageNumber) {
setName(NbBundle.getMessage(Costanti.class, Costanti.VIEW_BEST_MAPPINGS_TOP_COMPONENT));
setToolTipText(NbBundle.getMessage(Costanti.class, Costanti.VIEW_BEST_MAPPINGS_TOP_COMPONENT_TOOLTIP));
Image imageDefault = ImageUtilities.loadImage(Costanti.ICONA_VIEW_BEST_MAPPINGS, true);
this.setIcon(ImageUtilities.mergeImages(imageDefault, imageNumber, Scenario.X_OFFSET_IMAGE_NUMBER, Scenario.Y_OFFSET_IMAGE_NUMBER));
messageLabel = new JTextArea();
messageLabel.setRows(2);
messageLabel.setEditable(false);
messageLabel.setBackground(this.getBackground());
tabellaBestMappings = new JTable();
jScrollPane = new JScrollPane();
jScrollPane.setPreferredSize(new DimensionUIResource(150, this.getHeight()));
this.setPreferredSize(new Dimension(150, this.getHeight()));
this.setLayout(new BorderLayout());
this.add(messageLabel, BorderLayout.NORTH);
this.add(jScrollPane, BorderLayout.CENTER);
addSelectionListener();
}
示例7: testInstallDefaults
import javax.swing.plaf.DimensionUIResource; //导入依赖的package包/类
public void testInstallDefaults() {
JOptionPane pane = new JOptionPane();
UIManager.put("OptionPane.background", new ColorUIResource(Color.red));
UIManager.put("OptionPane.foreground", new ColorUIResource(Color.yellow));
UIManager.put("OptionPane.messageForeground", new ColorUIResource(Color.green));
Font font = new FontUIResource(pane.getFont().deriveFont(100f));
UIManager.put("OptionPane.font", font);
Border border = new BorderUIResource(BorderFactory.createEmptyBorder(1, 1, 1, 1));
UIManager.put("OptionPane.border", border);
Dimension minimumSize = new DimensionUIResource(123, 456);
UIManager.put("OptionPane.minimumSize", minimumSize);
pane.setUI(paneUI);
pane.setOptions(new Object[] { "button" });
paneUI.installDefaults();
assertEquals(Color.red, pane.getBackground());
assertEquals(Color.yellow, pane.getForeground());
assertEquals(font, pane.getFont());
assertEquals(border, pane.getBorder());
assertEquals(minimumSize, paneUI.getMinimumOptionPaneSize());
}
示例8: installOther
import javax.swing.plaf.DimensionUIResource; //导入依赖的package包/类
@Override
protected void installOther(UIDefaults table)
{
table.put(SCROLLBAR_WIDTH, 9);
table.put(SCROLLBAR_BACKGROUND, getColorRes(Color.WHITE));
table.put(MINIMUMTHUMBSIZE, new DimensionUIResource(48, 48));
}
示例9: uiImpl
import javax.swing.plaf.DimensionUIResource; //导入依赖的package包/类
/**
* Ui impl.
*/
public static void uiImpl()
{
UIManager.put("ProgressBar.background",new ColorUIResource(BeautyEyeLNFHelper.commonBackgroundColor));
UIManager.put("ProgressBar.selectionForeground",new ColorUIResource(BeautyEyeLNFHelper.commonBackgroundColor));
//* 此属性决定水平进度条的默认最小大小:15是相关于.9.png图片的最小填充
//* 高度或长度的(小于此高度则NinePatch算法无法解决而很难看)
UIManager.put("ProgressBar.horizontalSize",new DimensionUIResource(146,15));//默认是146,12
//* 此属性决定垂直进度条的默认最小大小:15是相关于.9.png图片的最小填充
//* 高度或长度的(小于此高度则NinePatch算法无法解决而很难看)
UIManager.put("ProgressBar.verticalSize",new DimensionUIResource(15,146));//默认是12,146
UIManager.put("ProgressBar.border",new BorderUIResource(BorderFactory.createEmptyBorder(0,0,0,0)));
UIManager.put("ProgressBarUI",org.jb2011.lnf.beautyeye.ch12_progress.BEProgressBarUI.class.getName());
}
示例10: myInitComponents
import javax.swing.plaf.DimensionUIResource; //导入依赖的package包/类
private void myInitComponents() {
this.setLayout(new BorderLayout());
this.scrollPane = new JScrollPane();
scrollPane.setPreferredSize(new DimensionUIResource(100, this.getHeight()));
this.setPreferredSize(new Dimension(100, this.getHeight()));
this.jTree = new JTree(null, false);
new TreeDragSource(jTree, DnDConstants.ACTION_COPY_OR_MOVE);
this.jTree.setDragEnabled(true);
// new TreeDropTarget(tree);
this.scrollPane.setViewportView(jTree);
this.add(this.scrollPane, BorderLayout.CENTER);
}
示例11: initComponent
import javax.swing.plaf.DimensionUIResource; //导入依赖的package包/类
private void initComponent() {
messageLabel = new JTextArea();
messageLabel.setRows(2);
messageLabel.setEditable(false);
messageLabel.setBackground(this.getBackground());
tabellaRankedTransformations = new JTable();
jScrollPane = new JScrollPane();
jScrollPane.setPreferredSize(new DimensionUIResource(150, this.getHeight()));
this.setPreferredSize(new Dimension(150, this.getHeight()));
this.setLayout(new BorderLayout());
this.add(messageLabel, BorderLayout.NORTH);
this.add(jScrollPane, BorderLayout.CENTER);
addSelectionListener();
}
示例12: testGetPreferredSize
import javax.swing.plaf.DimensionUIResource; //导入依赖的package包/类
public void testGetPreferredSize() {
JOptionPane pane = new JOptionPane() {
private static final long serialVersionUID = 1L;
@Override
public FontMetrics getFontMetrics(Font font) {
return BasicOptionPaneUITest.this.getFontMetrics(font);
}
};
Border messageAreaBorder = new BorderUIResource(BorderFactory.createEmptyBorder(3, 3,
3, 3));
UIManager.put("OptionPane.messageAreaBorder", messageAreaBorder);
messageAreaBorder = new BorderUIResource(BorderFactory.createEmptyBorder(4, 4, 4, 4));
UIManager.put("OptionPane.messageAreaBorder", messageAreaBorder);
Border border = new BorderUIResource(BorderFactory.createEmptyBorder(1, 1, 1, 1));
UIManager.put("OptionPane.border", border);
Dimension minimumSize = new DimensionUIResource(123, 456);
UIManager.put("OptionPane.minimumSize", minimumSize);
pane.setUI(paneUI);
assertNull(paneUI.getPreferredSize(null));
Dimension preferredSize = paneUI.getPreferredSize(pane);
assertNotNull(preferredSize);
assertTrue(preferredSize.width > 0);
assertTrue(preferredSize.height > 0);
LayoutManager layout = new MyLayoutManager(new Dimension(200, 500));
pane.setLayout(layout);
assertEquals(new Dimension(200, 500), paneUI.getPreferredSize(pane));
layout = new MyLayoutManager(new Dimension(200, 300));
pane.setLayout(layout);
assertEquals(new Dimension(200, 456), paneUI.getPreferredSize(pane));
layout = new MyLayoutManager(new Dimension(100, 500));
pane.setLayout(layout);
assertEquals(new Dimension(123, 500), paneUI.getPreferredSize(pane));
layout = new MyLayoutManager(new Dimension(10, 10));
pane.setLayout(layout);
assertEquals(new Dimension(123, 456), paneUI.getPreferredSize(pane));
}
示例13: createArrowButton
import javax.swing.plaf.DimensionUIResource; //导入依赖的package包/类
@Override
protected JButton createArrowButton() {
final Color bg = myComboBox.getBackground();
final Color fg = myComboBox.getForeground();
JButton button = new BasicArrowButton(SwingConstants.SOUTH, bg, fg, fg, fg) {
@Override
public void paint(Graphics g) {
Color borderColor = ModernUIUtil.getBorderColor(myComboBox);
GraphicsConfig config = new GraphicsConfig(g);
final int w = getWidth();
final int h = getHeight();
g.setColor(UIUtil.getControlColor());
g.fillRect(0, 0, w, h);
g.setColor(myComboBox.isEnabled() ? getForeground() : borderColor);
GraphicsUtil.setupAAPainting(g);
g.drawLine(JBUI.scale(3), JBUI.scale(7), JBUI.scale(7), JBUI.scale(11));
g.drawLine(JBUI.scale(7), JBUI.scale(11), JBUI.scale(11), JBUI.scale(7));
config.restore();
}
@Override
public Dimension getPreferredSize() {
int size = getFont().getSize() + JBUI.scale(4);
if (size % 2 == 1) size += JBUI.scale(1);
return new DimensionUIResource(size, size);
}
};
button.setBorder(BorderFactory.createEmptyBorder());
button.setOpaque(false);
return button;
}
示例14: getDimensionRes
import javax.swing.plaf.DimensionUIResource; //导入依赖的package包/类
protected DimensionUIResource getDimensionRes(int w, int h)
{
return new DimensionUIResource(w, h);
}
示例15: createArrowButton
import javax.swing.plaf.DimensionUIResource; //导入依赖的package包/类
protected JButton createArrowButton() {
final Color bg = myComboBox.getBackground();
final Color fg = myComboBox.getForeground();
JButton button = new BasicArrowButton(SwingConstants.SOUTH, bg, fg, fg, fg) {
@Override
public void paint(Graphics g2) {
final Graphics2D g = (Graphics2D)g2;
final GraphicsConfig config = new GraphicsConfig(g);
final int w = getWidth();
final int h = getHeight();
if (!isTableCellEditor(myComboBox)) {
g.setColor(getArrowButtonFillColor(UIUtil.getControlColor()));
g.fillRect(0, 0, w, h);
}
g.setColor(comboBox.isEnabled() ? new JBColor(Gray._255, getForeground()) : new JBColor(Gray._255, getBorderColor()));
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
g.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
final int tW = JBUI.scale(8);
final int tH = JBUI.scale(6);
final int xU = (w - tW) / 2;
final int yU = (h - tH) / 2;
g.translate(JBUI.scale(2), JBUI.scale(1));
final Path2D.Double path = new Path2D.Double();
path.moveTo(xU, yU);
path.lineTo(xU + tW, yU);
path.lineTo(xU + tW/2, yU + tH);
path.lineTo(xU, yU);
//path.moveTo(xU + 1, yU + 2);
//path.lineTo(3 * xU + 1, yU + 2);
//path.lineTo(2 * xU + 1, 3 * yU);
//path.lineTo(xU + 1, yU + 2);
path.closePath();
g.fill(path);
g.translate(-JBUI.scale(2), -JBUI.scale(1));
if (!isTableCellEditor(myComboBox)) {
g.setColor(getArrowButtonFillColor(getBorderColor()));
g.drawLine(0, -1, 0, h);
}
config.restore();
}
@Override
public Dimension getPreferredSize() {
int size = getFont().getSize() + 4;
if (size%2==1) size++;
return new DimensionUIResource(size, size);
}
};
button.setBorder(BorderFactory.createEmptyBorder());
button.setOpaque(false);
return button;
}