本文整理汇总了Java中com.bulenkov.iconloader.util.DoubleColor类的典型用法代码示例。如果您正苦于以下问题:Java DoubleColor类的具体用法?Java DoubleColor怎么用?Java DoubleColor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DoubleColor类属于com.bulenkov.iconloader.util包,在下文中一共展示了DoubleColor类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ImageScroller
import com.bulenkov.iconloader.util.DoubleColor; //导入依赖的package包/类
public ImageScroller(Icon icon) {
super();
JPanel p = new JPanel();
p.setBackground(new DoubleColor(Color.white, Gray._80));
p.setLayout(new BorderLayout());
p.add(new JLabel(icon), BorderLayout.CENTER);
getViewport().add(p);
getHorizontalScrollBar().setUnitIncrement(10);
getVerticalScrollBar().setUnitIncrement(10);
}
示例2: main
import com.bulenkov.iconloader.util.DoubleColor; //导入依赖的package包/类
public static void main(String args[]) {
JFrame frame = new JFrame();
RoundedPanel p = new RoundedPanel(new BorderLayout(), 16);
JPanel p2 = new JPanel();
p2.setBackground(DoubleColor.blue);
p.add(p2);
frame.add(p);
frame.setSize(200, 200);
frame.setVisible(true);
}
示例3: main
import com.bulenkov.iconloader.util.DoubleColor; //导入依赖的package包/类
public static void main(String args[]) {
JFrame frame = new JFrame();
JPanel panel = new JPanel();
frame.add(panel);
panel.add(new JLabel("north", new ArrowIcon(ArrowIcon.NORTH), JLabel.CENTER));
panel.add(new JLabel("west", new ArrowIcon(ArrowIcon.WEST), JLabel.CENTER));
panel.add(new JLabel("south", new ArrowIcon(ArrowIcon.SOUTH), JLabel.CENTER));
panel.add(new JLabel("east", new ArrowIcon(ArrowIcon.EAST), JLabel.CENTER));
panel.add(new JLabel("east-20", new ArrowIcon(ArrowIcon.EAST, 20, DoubleColor.blue), JLabel.CENTER));
frame.pack();
frame.setVisible(true);
}
示例4: createFrame
import com.bulenkov.iconloader.util.DoubleColor; //导入依赖的package包/类
private static JFrame createFrame() {
//<snip>Create frame and set simple properties
JFrame frame = new JFrame("Demo JFrame");
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
//</snip>
//<snip>Set Minimized/titlebar icon Image
//Note: How the image is used is platform-dependent
Image iconImage = null;
try {
// todo: swingingduke.gif doesn't exist
URL imageURL = FrameDemo.class.getResource("resources/images/swingingduke.gif");
iconImage = ImageIO.read(imageURL);
} catch (Exception e) {
// handle image IO exception
}
frame.setIconImage(iconImage);
//</snip>
//<snip>Make toplevel "busy"
// busy glasspane is initially invisible
frame.setGlassPane(new BusyGlass());
//</snip>
//<snip>Add a menubar
JMenuBar menubar = new JMenuBar();
frame.setJMenuBar(menubar);
JMenu menu = new JMenu("File");
menubar.add(menu);
menu.add("Open");
menu.add("Save");
//</snip>
//<snip>Add a horizontal toolbar
JToolBar toolbar = new JToolBar();
frame.add(toolbar, BorderLayout.NORTH);
toolbar.add(new JButton("Toolbar Button"));
//</snip>
//<snip>Add the content area
JLabel label = new JLabel("I'm content but a little blue.");
label.setHorizontalAlignment(JLabel.CENTER);
label.setPreferredSize(new Dimension(300, 160));
label.setBackground(new DoubleColor(new Color(197, 216, 236), new Color(102, 117, 136)));
label.setOpaque(true); // labels non-opaque by default
frame.add(label);
//snip
//<snip>Add a statusbar
JLabel statusLabel = new JLabel("I show status.");
statusLabel.setBorder(new EmptyBorder(4, 4, 4, 4));
statusLabel.setHorizontalAlignment(JLabel.LEADING);
frame.add(statusLabel, BorderLayout.SOUTH);
//</snip>
//<snip>Initialize frame's size to fit it's content
frame.pack();
//</snip>
return frame;
}
示例5: configureDefaults
import com.bulenkov.iconloader.util.DoubleColor; //导入依赖的package包/类
private void configureDefaults() {
// Color palette algorithm courtesy of Jasper Potts
Color controlColor = UIManager.getColor("control");
UIManager.put(CONTROL_VERY_LIGHT_SHADOW_KEY,
Utilities.deriveColorHSB(controlColor, 0, 0, -0.02f));
UIManager.put(CONTROL_LIGHT_SHADOW_KEY,
Utilities.deriveColorHSB(controlColor, 0, 0, -0.06f));
UIManager.put(CONTROL_MID_SHADOW_KEY,
Utilities.deriveColorHSB(controlColor, 0, 0, -0.16f));
UIManager.put(CONTROL_VERY_DARK_SHADOW_KEY,
Utilities.deriveColorHSB(controlColor, 0, 0, -0.5f));
UIManager.put(CONTROL_DARK_SHADOW_KEY,
Utilities.deriveColorHSB(controlColor, 0, 0, -0.32f));
// Calculate gradient colors for title panels
Color titleColor = UIManager.getColor(usingNimbus()? "nimbusBase" : "activeCaption");
// Some LAFs (e.g. GTK) don't contain "activeCaption"
if (titleColor == null) {
titleColor = controlColor;
}
float hsb[] = Color.RGBtoHSB(
titleColor.getRed(), titleColor.getGreen(), titleColor.getBlue(), null);
UIManager.put(TITLE_GRADIENT_COLOR1_KEY,
new DoubleColor(Color.getHSBColor(hsb[0]-.013f, .15f, .85f), new Color(0, 79, 114)));
UIManager.put(TITLE_GRADIENT_COLOR2_KEY,
new DoubleColor(Color.getHSBColor(hsb[0]-.005f, .24f, .80f), new Color(49, 113, 164)));
UIManager.put(TITLE_FOREGROUND_KEY,
new DoubleColor(Color.getHSBColor(hsb[0], .54f, .40f), new Color(0xbbbbbb)));
// Calculate highlight color for code pane
UIManager.put(CODE_HIGHLIGHT_KEY,
Color.getHSBColor(hsb[0]-.005f, .20f, .95f));
Font labelFont = UIManager.getFont("Label.font");
UIManager.put(TITLE_FONT_KEY, labelFont.deriveFont(Font.BOLD, labelFont.getSize()+4f));
Color panelColor = UIManager.getColor("Panel.background");
UIManager.put(SUB_PANEL_BACKGROUND_KEY,
Utilities.deriveColorHSB(panelColor, 0, 0, -.06f));
applyDefaults();
}
示例6: createArrowButton
import com.bulenkov.iconloader.util.DoubleColor; //导入依赖的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 DoubleColor(Gray._255, getForeground()) : new DoubleColor(Gray._255, getForeground().darker()));
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 xU = w / 4;
final int yU = h / 4;
final Path2D.Double path = new Path2D.Double();
g.translate(2, 0);
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(-2, 0);
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;
}
示例7: getBorderColor
import com.bulenkov.iconloader.util.DoubleColor; //导入依赖的package包/类
private static Color getBorderColor() {
return new DoubleColor(Gray._150, Gray._100);
}
示例8: paintIndeterminate
import com.bulenkov.iconloader.util.DoubleColor; //导入依赖的package包/类
@Override
protected void paintIndeterminate(Graphics g, JComponent c) {
if (!(g instanceof Graphics2D)) {
return;
}
Insets b = progressBar.getInsets(); // area for border
int barRectWidth = progressBar.getWidth() - (b.right + b.left);
int barRectHeight = progressBar.getHeight() - (b.top + b.bottom);
if (barRectWidth <= 0 || barRectHeight <= 0) {
return;
}
//boxRect = getBox(boxRect);
g.setColor(new DoubleColor(Gray._240, Gray._128));
int w = c.getWidth();
int h = c.getPreferredSize().height;
g.fillRect(0, (c.getHeight() - h)/2, w, h);
g.setColor(new DoubleColor(Gray._165, Gray._88));
GraphicsUtil.setupAAPainting(g);
Path2D.Double path = new Path2D.Double();
int ww = getPeriodLength() / 2;
g.translate(0, (c.getHeight() - h) / 2);
path.moveTo(0, 0);
path.lineTo(ww, 0);
path.lineTo(ww - h / 2, h);
path.lineTo(-h / 2, h);
path.lineTo(0, 0);
path.closePath();
int x = -offset;
while (x < Math.max(c.getWidth(), c.getHeight())) {
g.translate(x, 0);
((Graphics2D)g).fill(path);
g.translate(-x, 0);
x+= getPeriodLength();
}
offset = (offset + 1) % getPeriodLength();
Area area = new Area(new Rectangle2D.Double(0, 0, w, h));
area.subtract(new Area(new RoundRectangle2D.Double(1,1,w-2, h-2, 8,8)));
((Graphics2D)g).setPaint(Gray._128);
((Graphics2D)g).fill(area);
area.subtract(new Area(new RoundRectangle2D.Double(0, 0, w, h, 9, 9)));
((Graphics2D)g).setPaint(c.getParent().getBackground());
((Graphics2D)g).fill(area);
g.drawRoundRect(1, 1, w - 3, h - 3, 8, 8);
g.translate(0, -(c.getHeight() - h) / 2);
// Deal with possible text painting
if (progressBar.isStringPainted()) {
if (progressBar.getOrientation() == SwingConstants.HORIZONTAL) {
paintString(g, b.left, b.top, barRectWidth, barRectHeight, boxRect.x, boxRect.width);
}
else {
paintString(g, b.left, b.top, barRectWidth, barRectHeight, boxRect.y, boxRect.height);
}
}
}
示例9: getGradientLightColor
import com.bulenkov.iconloader.util.DoubleColor; //导入依赖的package包/类
public static DoubleColor getGradientLightColor() {
return new DoubleColor(Gray._251, Gray._95);
}
示例10: getGradientDarkColor
import com.bulenkov.iconloader.util.DoubleColor; //导入依赖的package包/类
public static DoubleColor getGradientDarkColor() {
return new DoubleColor(Gray._215, Gray._80);
}
示例11: getGradientThumbBorderColor
import com.bulenkov.iconloader.util.DoubleColor; //导入依赖的package包/类
private static DoubleColor getGradientThumbBorderColor() {
return new DoubleColor(Gray._201, Gray._85);
}
示例12: getTrackBackground
import com.bulenkov.iconloader.util.DoubleColor; //导入依赖的package包/类
public static DoubleColor getTrackBackground() {
return new DoubleColor(Gray._245, UIUtil.getListBackground());
}
示例13: getTrackBorderColor
import com.bulenkov.iconloader.util.DoubleColor; //导入依赖的package包/类
public static DoubleColor getTrackBorderColor() {
return new DoubleColor(Gray._230, UIUtil.getListBackground());
}
示例14: createRightOneTouchButton
import com.bulenkov.iconloader.util.DoubleColor; //导入依赖的package包/类
@Override
protected JButton createRightOneTouchButton() {
JButton b = new JButton() {
public void setBorder(Border border) {
}
public void paint(Graphics g) {
if (splitPane != null) {
int[] xs = new int[3];
int[] ys = new int[3];
int blockSize;
// Fill the background first ...
g.setColor(this.getBackground());
g.fillRect(0, 0, this.getWidth(),
this.getHeight());
// ... then draw the arrow.
if (orientation == JSplitPane.VERTICAL_SPLIT) {
blockSize = Math.min(getHeight(), ONE_TOUCH_SIZE);
xs[0] = blockSize;
xs[1] = blockSize << 1;
xs[2] = 0;
ys[0] = blockSize;
ys[1] = ys[2] = 0;
}
else {
blockSize = Math.min(getWidth(), ONE_TOUCH_SIZE);
xs[0] = xs[2] = 0;
xs[1] = blockSize;
ys[0] = 0;
ys[1] = blockSize;
ys[2] = blockSize << 1;
}
g.setColor(new DoubleColor(Gray._255, UIUtil.getLabelForeground()));
g.fillPolygon(xs, ys, 3);
}
}
// Don't want the button to participate in focus traversable.
public boolean isFocusTraversable() {
return false;
}
};
b.setMinimumSize(new Dimension(ONE_TOUCH_SIZE, ONE_TOUCH_SIZE));
b.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
b.setFocusPainted(false);
b.setBorderPainted(false);
b.setRequestFocusEnabled(false);
return b;
}