HMCL 2.3.2
@@ -0,0 +1,203 @@
|
||||
package org.jackhuang.hellominecraft.lookandfeel;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.Map;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.plaf.synth.SynthContext;
|
||||
import javax.swing.plaf.synth.SynthGraphicsUtils;
|
||||
|
||||
/**
|
||||
* NimbusGraphicsUtils - extends SynthGraphicsUtils to force all Synth painted
|
||||
* text to be antialiased and provides some static helper methods.
|
||||
*
|
||||
* @author Created by Jasper Potts (Jan 4, 2007)
|
||||
* @version 1.0
|
||||
*/
|
||||
public class GraphicsUtils extends SynthGraphicsUtils {
|
||||
|
||||
private Map<?, ?> desktopHints;
|
||||
|
||||
/**
|
||||
* Get rendering hints from a Graphics instance. "hintsToSave" is a Map of
|
||||
* RenderingHint key-values. For each hint key present in that map, the
|
||||
* value of that hint is obtained from the Graphics and stored as the value
|
||||
* for the key in savedHints.
|
||||
*
|
||||
* @param g2d the graphics surface
|
||||
* @param hintsToSave the list of rendering hints to set on the graphics
|
||||
* @param savedHints a set where to save the previous rendering hints, might
|
||||
* be null
|
||||
* @return the previous set of rendering hints
|
||||
*/
|
||||
public static RenderingHints getRenderingHints(Graphics2D g2d,
|
||||
Map<?, ?> hintsToSave,
|
||||
RenderingHints savedHints) {
|
||||
if (savedHints == null) {
|
||||
savedHints = new RenderingHints(null);
|
||||
} else {
|
||||
savedHints.clear();
|
||||
}
|
||||
if (hintsToSave.isEmpty()) {
|
||||
return savedHints;
|
||||
}
|
||||
/* RenderingHints.keySet() returns Set */
|
||||
for (Object o : hintsToSave.keySet()) {
|
||||
RenderingHints.Key key = (RenderingHints.Key) o;
|
||||
Object value = g2d.getRenderingHint(key);
|
||||
savedHints.put(key, value);
|
||||
}
|
||||
return savedHints;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides paintText in SynthGraphicsUtils to force all Synth painted text
|
||||
* to be antialiased
|
||||
*/
|
||||
@Override
|
||||
public void paintText(SynthContext ss, Graphics g, String text, int x, int y, int mnemonicIndex) {
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
|
||||
// XXX: In Java SE 6, Synth already uses the desktop hints, this code should just check whether java.version < 1.6
|
||||
if (desktopHints == null) {
|
||||
Toolkit toolkit = Toolkit.getDefaultToolkit();
|
||||
desktopHints = (Map<?, ?>) (toolkit.getDesktopProperty("awt.font.desktophints"));
|
||||
}
|
||||
|
||||
Object oldAA = null;
|
||||
RenderingHints oldHints = null;
|
||||
|
||||
if (desktopHints != null) {
|
||||
oldHints = getRenderingHints(g2, desktopHints, null);
|
||||
g2.addRenderingHints(desktopHints);
|
||||
} else {
|
||||
oldAA = g2.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING);
|
||||
g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
|
||||
RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||
}
|
||||
|
||||
super.paintText(ss, g, text, x, y, mnemonicIndex);
|
||||
|
||||
if (oldHints != null) {
|
||||
g2.addRenderingHints(oldHints);
|
||||
} else if (oldAA != null) {
|
||||
g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
|
||||
oldAA);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load an image using ImageIO from resource in
|
||||
* org.jdesktop.swingx.plaf.nimbus.images. Catches and prints all Exceptions
|
||||
* so that it can safely be used in a static context.
|
||||
*
|
||||
* @param imgName The name of the image to load, eg. "border.png"
|
||||
* @return The loaded image
|
||||
*/
|
||||
public static BufferedImage loadImage(String imgName) {
|
||||
try {
|
||||
return ImageIO.read(GraphicsUtils.class.getClassLoader().getResource("org/jackhuang/hellominecraft/lookandfeel/images/" + imgName));
|
||||
} catch (Exception e) {
|
||||
System.err.println("Error loading image \"org/jackhuang/hellominecraft/lookandfeel/images/" + imgName + "\"");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a Color object from a web color string of the form "FF00AB" or
|
||||
* "#FF00AB".
|
||||
*
|
||||
* @param c The color string
|
||||
* @return The Color described
|
||||
*/
|
||||
public static Color getWebColor(String c) {
|
||||
if (c.startsWith("#")) {
|
||||
c = c.substring(1);
|
||||
}
|
||||
return new Color(
|
||||
Integer.parseInt(c.substring(0, 2), 16),
|
||||
Integer.parseInt(c.substring(2, 4), 16),
|
||||
Integer.parseInt(c.substring(4, 6), 16)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a Color object from a web color string of the form "FF00AB" or
|
||||
* "#FF00AB".
|
||||
*
|
||||
* @param c The color string
|
||||
* @return The Color described
|
||||
*/
|
||||
public static Color getWebColorWithAlpha(String c) {
|
||||
if (c.startsWith("#")) {
|
||||
c = c.substring(1);
|
||||
}
|
||||
return new Color(
|
||||
Integer.parseInt(c.substring(0, 2), 16),
|
||||
Integer.parseInt(c.substring(2, 4), 16),
|
||||
Integer.parseInt(c.substring(4, 6), 16),
|
||||
Integer.parseInt(c.substring(6, 8), 16)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a Color that is 50% inbetween the two web colors given. The Web
|
||||
* colors are of the form "FF00AB" or "#FF00AB".
|
||||
*
|
||||
* @param c1 The first color string
|
||||
* @param c2 The second color string
|
||||
* @return The Color middle color
|
||||
*/
|
||||
public static Color getMidWebColor(String c1, String c2) {
|
||||
return getMidWebColor(c1, c2, 50);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a Color that is 50% inbetween the two web colors given. The Web
|
||||
* colors are of the form "FF00AB" or "#FF00AB".
|
||||
*
|
||||
* @param c1 The first color string
|
||||
* @param c2 The second color string
|
||||
* @return The Color middle color
|
||||
*/
|
||||
public static Color getMidWebColor(String c1, String c2, int percent) {
|
||||
if (c1.startsWith("#")) {
|
||||
c1 = c1.substring(1);
|
||||
}
|
||||
if (c2.startsWith("#")) {
|
||||
c2 = c2.substring(1);
|
||||
}
|
||||
int rTop = Integer.parseInt(c1.substring(0, 2), 16);
|
||||
int gTop = Integer.parseInt(c1.substring(2, 4), 16);
|
||||
int bTop = Integer.parseInt(c1.substring(4, 6), 16);
|
||||
int rBot = Integer.parseInt(c2.substring(0, 2), 16);
|
||||
int gBot = Integer.parseInt(c2.substring(2, 4), 16);
|
||||
int bBot = Integer.parseInt(c2.substring(4, 6), 16);
|
||||
int rMid = rTop + ((rBot - rTop) * percent / 100);
|
||||
int gMid = gTop + ((gBot - gTop) * percent / 100);
|
||||
int bMid = bTop + ((bBot - bTop) * percent / 100);
|
||||
return new Color(rMid, gMid, bMid);
|
||||
}
|
||||
|
||||
public static Color getMidWebColor(Color c1, Color c2, int percent) {
|
||||
int rTop = c1.getRed();
|
||||
int gTop = c1.getGreen();
|
||||
int bTop = c1.getBlue();
|
||||
int aTop = c1.getAlpha();
|
||||
int rBot = c2.getRed();
|
||||
int gBot = c2.getGreen();
|
||||
int bBot = c2.getBlue();
|
||||
int aBot = c2.getAlpha();
|
||||
int rMid = rTop + ((rBot - rTop) * percent / 100);
|
||||
int gMid = gTop + ((gBot - gTop) * percent / 100);
|
||||
int bMid = bTop + ((bBot - bTop) * percent / 100);
|
||||
int aMid = aTop + ((aBot - aTop) * percent / 100);
|
||||
return new Color(rMid, gMid, bMid, aMid);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.lookandfeel;
|
||||
|
||||
import java.text.ParseException;
|
||||
import javax.swing.plaf.synth.SynthLookAndFeel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
*/
|
||||
public class HelloMinecraftLookAndFeel extends SynthLookAndFeel {
|
||||
|
||||
/**
|
||||
* Creates a new instance of NimbusLookAndFeel
|
||||
*/
|
||||
public HelloMinecraftLookAndFeel() throws ParseException {
|
||||
load(HelloMinecraftLookAndFeel.class.getResourceAsStream("/org/jackhuang/hellominecraft/lookandfeel/synth.xml"), HelloMinecraftLookAndFeel.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a short string that identifies this look and feel.
|
||||
*
|
||||
* @return a short string identifying this look and feel.
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "HelloMinecraftLookAndFeel";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a string that identifies this look and feel.
|
||||
*
|
||||
* @return a short string identifying this look and feel.
|
||||
*/
|
||||
@Override
|
||||
public String getID() {
|
||||
return "HelloMinecraftLookAndFeel";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a textual description of this look and feel.
|
||||
*
|
||||
* @return textual description of this look and feel.
|
||||
*/
|
||||
public String getDescription() {
|
||||
return "HelloMinecraftLookAndFeel";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package org.jackhuang.hellominecraft.lookandfeel.components;
|
||||
|
||||
import java.awt.Color;
|
||||
import org.jackhuang.hellominecraft.lookandfeel.GraphicsUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
*/
|
||||
public class ConstomButton extends javax.swing.JButton {
|
||||
public Color normalFg = GraphicsUtils.getWebColorWithAlpha("DDDDDD3F"), normalBg = GraphicsUtils.getWebColorWithAlpha("DDDDDD3F"),
|
||||
prelightFg = GraphicsUtils.getWebColorWithAlpha("FFFFFF7F"), prelightBg = GraphicsUtils.getWebColorWithAlpha("FFFFFF7F"),
|
||||
activeFg = GraphicsUtils.getWebColorWithAlpha("EAEDF83F"), activeBg = GraphicsUtils.getWebColorWithAlpha("EAEDF83F");
|
||||
public int drawPercent = 0;
|
||||
public long lastDrawTime = 0;
|
||||
public int radix = 0;
|
||||
public boolean notDraw = false;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package org.jackhuang.hellominecraft.lookandfeel.components;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
*/
|
||||
public interface IConstomable {
|
||||
boolean constomBackground();
|
||||
boolean constomForeground();
|
||||
}
|
||||
@@ -0,0 +1,277 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.lookandfeel.painters;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hyh
|
||||
*/
|
||||
/*
|
||||
* $Id: MetroGraphicsUtils.java,v 1.9 2005/12/05 15:00:55 kizune Exp $
|
||||
*
|
||||
* Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
|
||||
* Santa Clara, California 95054, U.S.A. All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.awt.geom.RoundRectangle2D;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.plaf.synth.SynthConstants;
|
||||
import javax.swing.plaf.synth.SynthContext;
|
||||
import javax.swing.plaf.synth.SynthPainter;
|
||||
import org.jackhuang.hellominecraft.lookandfeel.GraphicsUtils;
|
||||
import org.jackhuang.hellominecraft.lookandfeel.components.ConstomButton;
|
||||
|
||||
/**
|
||||
* ButtonPainter - handles painting Nimbus style buttons with Java2D
|
||||
*
|
||||
* @author Created by Jasper Potts (Jan 4, 2007)
|
||||
* @version 1.0
|
||||
*/
|
||||
public class ButtonPainter extends SynthPainter {
|
||||
|
||||
private static final String DEFAULT_NORMAL = "D5D5D5";
|
||||
private static final Color[] DEFAULT_NORMAL_FG = new Color[]{
|
||||
GraphicsUtils.getWebColor(DEFAULT_NORMAL),
|
||||
GraphicsUtils.getWebColor(DEFAULT_NORMAL)
|
||||
};
|
||||
private static final String DEFAULT_PRELIGHT = "A9A9A9";
|
||||
private static final Color[] DEFAULT_PRELIGHT_FG = new Color[]{
|
||||
GraphicsUtils.getWebColor(DEFAULT_PRELIGHT),
|
||||
GraphicsUtils.getWebColor(DEFAULT_PRELIGHT)
|
||||
};
|
||||
private static final String DEFAULT_ACTIVE = "222222";
|
||||
private static final Color[] DEFAULT_ACTIVE_FG = new Color[]{
|
||||
GraphicsUtils.getWebColor(DEFAULT_ACTIVE),
|
||||
GraphicsUtils.getWebColor(DEFAULT_ACTIVE)
|
||||
};
|
||||
|
||||
private static final Color[] DISABLED_BG = new Color[]{
|
||||
GraphicsUtils.getWebColor("E3EFE9"),
|
||||
GraphicsUtils.getMidWebColor("E3EFE9", "DFE2E6"),
|
||||
GraphicsUtils.getWebColor("DFE2E6"),
|
||||
GraphicsUtils.getMidWebColor("DFE2E6", "D6D9DF"),
|
||||
GraphicsUtils.getWebColor("D6D9DF"),
|
||||
GraphicsUtils.getWebColor("D6D9DF"),
|
||||
GraphicsUtils.getMidWebColor("D6D9DF", "D8DBE1"),
|
||||
GraphicsUtils.getWebColor("D8DBE1"),
|
||||
GraphicsUtils.getWebColor("DADDE3")
|
||||
};
|
||||
private static final Color[] DISABLED_FG = new Color[]{
|
||||
GraphicsUtils.getWebColor("C9CCD2"),
|
||||
GraphicsUtils.getWebColor("C9CCD2"),
|
||||
GraphicsUtils.getWebColor("BCBFC5"),
|
||||
GraphicsUtils.getWebColor("BCBFC5")
|
||||
};
|
||||
|
||||
private static boolean processCustomButton(final ConstomButton c, int add) {
|
||||
if (System.currentTimeMillis() > c.lastDrawTime) {
|
||||
c.lastDrawTime = System.currentTimeMillis();
|
||||
c.drawPercent += add;
|
||||
if (c.drawPercent > 100 && add > 0) {
|
||||
c.drawPercent = 100;
|
||||
} else if (c.drawPercent < 0 && add < 0) {
|
||||
c.drawPercent = 0;
|
||||
} else {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
c.updateUI();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void paintButtonBackground(SynthContext context, Graphics g, int x, int y, int w, int h) {
|
||||
Graphics2D g2 = (Graphics2D) g.create();
|
||||
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
Color[] fg, bg;
|
||||
if ((context.getComponentState() & SynthConstants.DEFAULT) != 0) {
|
||||
if ((context.getComponentState() & SynthConstants.PRESSED) != 0) {
|
||||
if (context.getComponent() instanceof ConstomButton) {
|
||||
ConstomButton c = (ConstomButton) context.getComponent();
|
||||
fg = new Color[]{c.activeFg, c.activeFg};
|
||||
bg = new Color[]{c.activeFg, c.activeFg};
|
||||
} else {
|
||||
fg = DEFAULT_ACTIVE_FG;
|
||||
bg = DEFAULT_ACTIVE_FG;
|
||||
}
|
||||
} else if ((context.getComponentState() & SynthConstants.DISABLED) != 0) {
|
||||
return;
|
||||
//fg = DISABLED_FG;
|
||||
//bg = DISABLED_BG;
|
||||
} else if ((context.getComponentState() & SynthConstants.MOUSE_OVER) != 0) {
|
||||
if (context.getComponent() instanceof ConstomButton) {
|
||||
final ConstomButton c = (ConstomButton) context.getComponent();
|
||||
if (!processCustomButton(c, 1)) {
|
||||
return;
|
||||
}
|
||||
Color fgs = GraphicsUtils.getMidWebColor(c.normalFg, c.prelightFg, c.drawPercent);
|
||||
Color bgs = GraphicsUtils.getMidWebColor(c.normalBg, c.prelightBg, c.drawPercent);
|
||||
fg = new Color[]{fgs, fgs};
|
||||
bg = new Color[]{bgs, bgs};
|
||||
} else {
|
||||
fg = DEFAULT_PRELIGHT_FG;
|
||||
bg = DEFAULT_PRELIGHT_FG;
|
||||
}
|
||||
} else {
|
||||
if (context.getComponent() instanceof ConstomButton) {
|
||||
final ConstomButton c = (ConstomButton) context.getComponent();
|
||||
if (!processCustomButton(c, -1)) {
|
||||
return;
|
||||
}
|
||||
Color fgs = GraphicsUtils.getMidWebColor(c.normalFg, c.prelightFg, c.drawPercent);
|
||||
Color bgs = GraphicsUtils.getMidWebColor(c.normalBg, c.prelightBg, c.drawPercent);
|
||||
fg = new Color[]{fgs, fgs};
|
||||
bg = new Color[]{bgs, bgs};
|
||||
} else {
|
||||
fg = DEFAULT_NORMAL_FG;
|
||||
bg = DEFAULT_NORMAL_FG;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ((context.getComponentState() & SynthConstants.PRESSED) != 0) {
|
||||
if (context.getComponent() instanceof ConstomButton) {
|
||||
ConstomButton c = (ConstomButton) context.getComponent();
|
||||
fg = new Color[]{c.activeFg, c.activeFg};
|
||||
bg = new Color[]{c.activeFg, c.activeFg};
|
||||
} else {
|
||||
fg = DEFAULT_ACTIVE_FG;
|
||||
bg = DEFAULT_ACTIVE_FG;
|
||||
}
|
||||
} else if ((context.getComponentState() & SynthConstants.DISABLED) != 0) {
|
||||
return;
|
||||
//fg = DISABLED_FG;
|
||||
//bg = DISABLED_BG;
|
||||
} else if ((context.getComponentState() & SynthConstants.MOUSE_OVER) != 0) {
|
||||
if (context.getComponent() instanceof ConstomButton) {
|
||||
final ConstomButton c = (ConstomButton) context.getComponent();
|
||||
if (!processCustomButton(c, 1)) {
|
||||
return;
|
||||
}
|
||||
Color fgs = GraphicsUtils.getMidWebColor(c.normalFg, c.prelightFg, c.drawPercent);
|
||||
Color bgs = GraphicsUtils.getMidWebColor(c.normalBg, c.prelightBg, c.drawPercent);
|
||||
fg = new Color[]{fgs, fgs};
|
||||
bg = new Color[]{bgs, bgs};
|
||||
} else {
|
||||
if (context.getComponent() instanceof ConstomButton) {
|
||||
ConstomButton c = (ConstomButton) context.getComponent();
|
||||
fg = new Color[]{c.prelightFg, c.prelightFg};
|
||||
bg = new Color[]{c.prelightBg, c.prelightBg};
|
||||
} else {
|
||||
fg = DEFAULT_PRELIGHT_FG;
|
||||
bg = DEFAULT_PRELIGHT_FG;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (context.getComponent() instanceof ConstomButton) {
|
||||
final ConstomButton c = (ConstomButton) context.getComponent();
|
||||
if (!processCustomButton(c, -1)) {
|
||||
return;
|
||||
}
|
||||
Color fgs = GraphicsUtils.getMidWebColor(c.normalFg, c.prelightFg, c.drawPercent);
|
||||
Color bgs = GraphicsUtils.getMidWebColor(c.normalBg, c.prelightBg, c.drawPercent);
|
||||
fg = new Color[]{fgs, fgs};
|
||||
bg = new Color[]{bgs, bgs};
|
||||
} else {
|
||||
fg = DEFAULT_NORMAL_FG;
|
||||
bg = DEFAULT_NORMAL_FG;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*w = w - 2;
|
||||
h = h - 2;
|
||||
|
||||
g2.setPaint(new LinearGradientPaint(x, y, x, y + h,
|
||||
new float[]{0, 1}, bg));
|
||||
g2.fillRect(x, y, w, h);
|
||||
|
||||
g2.setPaint(new LinearGradientPaint(x, y, x, y + h,
|
||||
new float[]{0, 1}, fg));
|
||||
g2.drawRect(x, y, w, h);*/
|
||||
|
||||
int radix = (context.getComponent() instanceof ConstomButton) ? ((ConstomButton) context.getComponent()).radix : 0;
|
||||
|
||||
g2.setColor(fg[0]);
|
||||
RoundRectangle2D fgshape = new RoundRectangle2D.Float(x, y, w, h, radix, radix);
|
||||
g2.draw(fgshape);
|
||||
g2.setColor(bg[0]);
|
||||
RoundRectangle2D bgshape = new RoundRectangle2D.Float(x, y, w, h, radix, radix);
|
||||
g2.fill(bgshape);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintToggleButtonBackground(SynthContext context, Graphics g, int x, int y, int w, int h) {
|
||||
Graphics2D g2 = (Graphics2D) g.create();
|
||||
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
Color[] fg, bg;
|
||||
if ((context.getComponentState() & SynthConstants.DEFAULT) != 0) {
|
||||
if ((context.getComponentState() & SynthConstants.PRESSED) != 0 || (context.getComponentState() & SynthConstants.SELECTED) != 0) {
|
||||
fg = DEFAULT_ACTIVE_FG;
|
||||
bg = DEFAULT_ACTIVE_FG;
|
||||
} else if ((context.getComponentState() & SynthConstants.DISABLED) != 0) {
|
||||
fg = DISABLED_FG;
|
||||
bg = DISABLED_BG;
|
||||
} else if ((context.getComponentState() & SynthConstants.MOUSE_OVER) != 0) {
|
||||
fg = DEFAULT_PRELIGHT_FG;
|
||||
bg = DEFAULT_PRELIGHT_FG;
|
||||
} else {
|
||||
fg = DEFAULT_NORMAL_FG;
|
||||
bg = DEFAULT_NORMAL_FG;
|
||||
}
|
||||
} else {
|
||||
if ((context.getComponentState() & SynthConstants.PRESSED) != 0 || (context.getComponentState() & SynthConstants.SELECTED) != 0) {
|
||||
fg = DEFAULT_ACTIVE_FG;
|
||||
bg = DEFAULT_ACTIVE_FG;
|
||||
} else if ((context.getComponentState() & SynthConstants.DISABLED) != 0) {
|
||||
fg = DISABLED_FG;
|
||||
bg = DISABLED_BG;
|
||||
} else if ((context.getComponentState() & SynthConstants.MOUSE_OVER) != 0) {
|
||||
fg = DEFAULT_PRELIGHT_FG;
|
||||
bg = DEFAULT_PRELIGHT_FG;
|
||||
} else {
|
||||
fg = DEFAULT_NORMAL_FG;
|
||||
bg = DEFAULT_NORMAL_FG;
|
||||
}
|
||||
}
|
||||
g2.setColor(fg[0]);
|
||||
Rectangle2D fgshape = new Rectangle2D.Float(x, y, w, h);
|
||||
g2.draw(fgshape);
|
||||
g2.setColor(bg[0]);
|
||||
Rectangle2D bgshape = new Rectangle2D.Float(x, y, w, h);
|
||||
g2.fill(bgshape);
|
||||
|
||||
/*g2.setPaint(new LinearGradientPaint(x, y, x, y + h,
|
||||
new float[]{0, 1}, bg));
|
||||
g2.fillRect(x, y, w, h);
|
||||
|
||||
g2.setPaint(new LinearGradientPaint(x, y, x, y + h,
|
||||
new float[]{0, 1}, fg));
|
||||
g2.drawRect(x, y, w, h);*/
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.lookandfeel.painters;
|
||||
|
||||
/*
|
||||
* $Id: MetroGraphicsUtils.java,v 1.9 2005/12/05 15:00:55 kizune Exp $
|
||||
*
|
||||
* Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
|
||||
* Santa Clara, California 95054, U.S.A. All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
import org.jackhuang.hellominecraft.lookandfeel.GraphicsUtils;
|
||||
|
||||
import javax.swing.plaf.synth.SynthContext;
|
||||
import javax.swing.plaf.synth.SynthPainter;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.LinearGradientPaint;
|
||||
|
||||
/**
|
||||
* ProgressPainter - Synth painter for Nimbus progressbars
|
||||
*
|
||||
* @author Created by Jasper Potts (Jan 3, 2007)
|
||||
* @version 1.0
|
||||
*/
|
||||
public class ProgressPainter extends SynthPainter {
|
||||
|
||||
private static final float[] NORMAL_BG_PTS = new float[]{0, 1};
|
||||
private static final Color[] NORMAL_BG = new Color[]{
|
||||
GraphicsUtils.getWebColor("c6c6c6"),
|
||||
GraphicsUtils.getWebColor("c6c6c6")
|
||||
};
|
||||
private static final float[] NORMAL_FG_PTS = new float[]{0, 1};
|
||||
private static final Color[] NORMAL_FG = new Color[]{
|
||||
GraphicsUtils.getWebColor("c6c6c6"),
|
||||
GraphicsUtils.getWebColor("c6c6c6")
|
||||
};
|
||||
private static final float[] BAR_BG_PTS = new float[]{0, 1};
|
||||
private static final Color[] BAR_BG = new Color[]{
|
||||
GraphicsUtils.getWebColor("41B1E1"),
|
||||
GraphicsUtils.getWebColor("41B1E1")
|
||||
};
|
||||
private static final float[] BAR_FG_PTS = new float[]{0, 1};
|
||||
private static final Color[] BAR_FG = new Color[]{
|
||||
GraphicsUtils.getWebColor("41B1E1"),
|
||||
GraphicsUtils.getWebColor("41B1E1")
|
||||
};
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void paintProgressBarBackground(SynthContext context, Graphics g, int x, int y, int w, int h,
|
||||
int orientation) {
|
||||
Graphics2D g2 = (Graphics2D) g.create();
|
||||
g2.setPaint(new LinearGradientPaint(x, y + 3, x, y + h - 4, NORMAL_BG_PTS, NORMAL_BG));
|
||||
if (x + 2 < w - 5 && y + 2 < h - 5) {
|
||||
g2.fillRect(x + 2, y + 2, w - 5, h - 5);
|
||||
}
|
||||
g2.setPaint(new LinearGradientPaint(x, y + 2, x, y + h - 5, NORMAL_FG_PTS, NORMAL_FG));
|
||||
if (x + 2 < w - 5 && y + 2 < h - 5) {
|
||||
g2.drawRect(x + 2, y + 2, w - 5, h - 5);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void paintProgressBarForeground(SynthContext context, Graphics g, int x, int y, int w, int h,
|
||||
int orientation) {
|
||||
Graphics2D g2 = (Graphics2D) g.create();
|
||||
g2.setPaint(new LinearGradientPaint(x, y + 3, x, y + h - 4, BAR_BG_PTS, BAR_BG));
|
||||
if (x + 2 < w - 5 && y + 2 < h - 5) {
|
||||
g2.fillRect(x + 2, y + 2, w - 5, h - 5);
|
||||
}
|
||||
g2.setPaint(new LinearGradientPaint(x, y + 2, x, y + h - 2, BAR_FG_PTS, BAR_FG));
|
||||
if (x + 2 < w - 5 && y + 2 < h - 5) {
|
||||
g2.drawRect(x + 2, y + 2, w - 5, h - 5);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void paintProgressBarBorder(SynthContext context, Graphics g, int x, int y, int w, int h, int orientation) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.lookandfeel.painters;
|
||||
|
||||
/*
|
||||
* $Id: NimbusGraphicsUtils.java,v 1.9 2005/12/05 15:00:55 kizune Exp $
|
||||
*
|
||||
* Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
|
||||
* Santa Clara, California 95054, U.S.A. All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
import javax.swing.plaf.synth.SynthContext;
|
||||
import javax.swing.plaf.synth.SynthPainter;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import javax.swing.plaf.synth.SynthConstants;
|
||||
import org.jackhuang.hellominecraft.lookandfeel.GraphicsUtils;
|
||||
|
||||
/**
|
||||
* TextFieldPainter
|
||||
*
|
||||
* @author Created by Jasper Potts (Jan 4, 2007)
|
||||
* @version 1.0
|
||||
*/
|
||||
public class TextFieldPainter extends SynthPainter {
|
||||
|
||||
private boolean fill = true;
|
||||
|
||||
private static final Color disabled = GraphicsUtils.getWebColor("F3F3F3"),
|
||||
normal = GraphicsUtils.getWebColor("CCCCCC"),
|
||||
focused = GraphicsUtils.getWebColor("000000"),
|
||||
over = GraphicsUtils.getWebColor("7F7F7F");
|
||||
|
||||
public TextFieldPainter() {}
|
||||
|
||||
public TextFieldPainter(boolean fill) {
|
||||
this.fill = fill;
|
||||
}
|
||||
|
||||
private void paintFieldBackground(SynthContext context, Graphics g, int x, int y, int w, int h) {
|
||||
w--;
|
||||
h--;
|
||||
if (fill) {
|
||||
g.setColor(Color.WHITE);
|
||||
g.fillRect(x, y, w, h);
|
||||
}
|
||||
Color color = null;
|
||||
if((context.getComponentState() & SynthConstants.MOUSE_OVER) != 0) {
|
||||
color = over;
|
||||
} else if((context.getComponentState() & SynthConstants.DISABLED) != 0) {
|
||||
color = disabled;
|
||||
} else if((context.getComponentState() & SynthConstants.FOCUSED) != 0) {
|
||||
color = focused;
|
||||
} else {
|
||||
color = normal;
|
||||
}
|
||||
g.setColor(color);
|
||||
g.drawLine(x, y, x + w, y);
|
||||
g.drawLine(x, y, x, y + w);
|
||||
g.drawLine(x + w, y, x + w, y + h);
|
||||
g.drawLine(x, y + h, x + w, y + h);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintPasswordFieldBackground(SynthContext context, Graphics g, int x, int y, int w, int h) {
|
||||
paintFieldBackground(context, g, x, y, w, h);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintTextAreaBackground(SynthContext context, Graphics g, int x, int y, int w, int h) {
|
||||
paintFieldBackground(context, g, x, y, w, h);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintTextFieldBackground(SynthContext context, Graphics g, int x, int y, int w, int h) {
|
||||
paintFieldBackground(context, g, x, y, w, h);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintTextPaneBackground(SynthContext context, Graphics g, int x, int y, int w, int h) {
|
||||
paintFieldBackground(context, g, x, y, w, h);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintScrollPaneBackground(SynthContext context, Graphics g, int x, int y, int w, int h) {
|
||||
paintFieldBackground(context, g, x, y, w, h);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,277 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.lookandfeel.ui;
|
||||
|
||||
import static org.jackhuang.hellominecraft.lookandfeel.GraphicsUtils.loadImage;
|
||||
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.basic.BasicComboBoxUI;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.ListCellRenderer;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.Insets;
|
||||
import java.awt.LayoutManager;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Container;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
/**
|
||||
* NimbusComboBoxUI
|
||||
*
|
||||
* @author Created by Jasper Potts (Feb 1, 2007)
|
||||
* @version 1.0
|
||||
*/
|
||||
public class ComboBoxUI extends BasicComboBoxUI implements MouseListener {
|
||||
|
||||
private static final BufferedImage combo_normal = loadImage("combo_normal.png");
|
||||
private static final BufferedImage combo_over = loadImage("combo_over.png");
|
||||
private static final BufferedImage combo_pressed = loadImage("combo_pressed.png");
|
||||
private static final BufferedImage combo_disabled = loadImage("combo_disabled.png");
|
||||
private static final Dimension BTN_SIZE = new Dimension(17, 20);
|
||||
private final Dimension btnSize = new Dimension(BTN_SIZE);
|
||||
|
||||
/**
|
||||
* Creates a new UI deligate for the given component. It is a standard
|
||||
* method that all UI deligates must have.
|
||||
*
|
||||
* @param c The component that the UI is for
|
||||
* @return a new instance of NimbusComboBoxUI
|
||||
*/
|
||||
public static ComponentUI createUI(JComponent c) {
|
||||
return new ComboBoxUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void installUI(JComponent c) {
|
||||
super.installUI(c);
|
||||
c.setOpaque(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installListeners() {
|
||||
super.installListeners();
|
||||
comboBox.addMouseListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void uninstallListeners() {
|
||||
super.uninstallListeners();
|
||||
comboBox.removeMouseListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* The minumum size is the size of the display area plus insets plus the
|
||||
* button.
|
||||
*/
|
||||
public Dimension getMinimumSize(JComponent c) {
|
||||
if (!isMinimumSizeDirty) {
|
||||
return new Dimension(cachedMinimumSize);
|
||||
}
|
||||
Dimension size = getDisplaySize();
|
||||
Insets insets = getInsets();
|
||||
btnSize.height = size.height = Math.max(size.height, BTN_SIZE.height);
|
||||
btnSize.width = (int) ((double) (BTN_SIZE.width / (double) BTN_SIZE.height) * btnSize.height);
|
||||
size.height += insets.top + insets.bottom;
|
||||
size.width += insets.left + insets.right + btnSize.width;
|
||||
|
||||
cachedMinimumSize.setSize(size.width, size.height);
|
||||
isMinimumSizeDirty = false;
|
||||
|
||||
return new Dimension(size);
|
||||
}
|
||||
|
||||
protected JButton createArrowButton() {
|
||||
JButton button = new JButton() {
|
||||
@Override
|
||||
protected void paintComponent(Graphics g) {
|
||||
if (comboBox.isEditable()) {
|
||||
BufferedImage img = combo_normal;
|
||||
if (mouseDown) {
|
||||
img = combo_pressed;
|
||||
} else if (!comboBox.isEnabled()) {
|
||||
img = combo_normal;
|
||||
} else if (mouseInside) {
|
||||
img = combo_over;
|
||||
}
|
||||
g.drawImage(img,
|
||||
0, 0, getWidth(), getHeight(),
|
||||
0, 0, img.getWidth(), img.getHeight(), comboBox);
|
||||
}
|
||||
}
|
||||
};
|
||||
button.addMouseListener(this);
|
||||
button.setMinimumSize(BTN_SIZE);
|
||||
button.setPreferredSize(BTN_SIZE);
|
||||
button.setMargin(new Insets(0, 0, 0, 0));
|
||||
return button;
|
||||
}
|
||||
|
||||
public void paint(Graphics g, JComponent c) {
|
||||
hasFocus = comboBox.hasFocus();
|
||||
ListCellRenderer renderer = comboBox.getRenderer();
|
||||
Rectangle r = new Rectangle(0, 0, comboBox.getWidth(), comboBox.getHeight());
|
||||
paintCurrentValueBackground(g, r, hasFocus);
|
||||
if (!comboBox.isEditable()) {
|
||||
if (renderer instanceof JComponent) {
|
||||
((JComponent) renderer).setOpaque(false);
|
||||
((JComponent) renderer).setForeground(comboBox.getForeground());
|
||||
}
|
||||
paintCurrentValue(g, rectangleForCurrentValue(), false);
|
||||
if (renderer instanceof JComponent) {
|
||||
((JComponent) renderer).setOpaque(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintCurrentValueBackground(Graphics g, Rectangle bounds, boolean hasFocus) {
|
||||
if (!comboBox.isEditable()) {
|
||||
BufferedImage img = combo_normal;
|
||||
if (!comboBox.isEnabled()) {
|
||||
img = combo_disabled;
|
||||
} else if (mouseDown) {
|
||||
img = combo_pressed;
|
||||
} else if (mouseInside) {
|
||||
img = combo_over;
|
||||
}
|
||||
g.drawImage(img,
|
||||
bounds.x, bounds.y, bounds.x + 4, bounds.y + bounds.height,
|
||||
0, 0, 1, 26, comboBox);
|
||||
g.drawImage(img,
|
||||
bounds.x + 1, bounds.y, bounds.x + bounds.width - 25, bounds.y + bounds.height,
|
||||
1, 0, 3, 26, comboBox);
|
||||
g.drawImage(img,
|
||||
bounds.x + bounds.width - 25, bounds.y, bounds.x + bounds.width, bounds.y + bounds.height,
|
||||
4, 0, 29, 26, comboBox);
|
||||
} else {
|
||||
/*g.setColor(Color.WHITE);
|
||||
g.fillRect(bounds.x, bounds.y, bounds.width - btnSize.width, bounds.height - 1);
|
||||
int x = bounds.x, y = bounds.y, w = bounds.width - btnSize.width, h = bounds.height - 1;
|
||||
Insets insets = getInsets();
|
||||
g.setColor(new Color(141, 142, 143));
|
||||
g.drawLine(x, y, x + insets.left, y);
|
||||
g.setColor(new Color(203, 203, 204));
|
||||
g.drawLine(x + 1, y + 1, x + insets.left, y + 1);
|
||||
g.setColor(new Color(152, 152, 153));
|
||||
g.drawLine(x, y + 1, x, y + 1);
|
||||
g.setColor(new Color(242, 242, 242));
|
||||
g.drawLine(x + 1, y + 2, x + insets.left, y + 2);
|
||||
g.setColor(new Color(176, 176, 177));
|
||||
g.drawLine(x, y + 2, x, y + 2);
|
||||
g.setColor(new Color(192, 192, 193));
|
||||
g.drawLine(x, y + h, x + insets.left, y + h);
|
||||
g.setColor(new Color(184, 184, 185));
|
||||
g.drawLine(x, y + 3, x, y + h);*/
|
||||
}
|
||||
}
|
||||
|
||||
protected LayoutManager createLayoutManager() {
|
||||
return new ComboLayout();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Insets getInsets() {
|
||||
return new Insets(0, 5, 0, 0);
|
||||
}
|
||||
// =================================================================================================================
|
||||
// MouseListener Methods
|
||||
private boolean mouseInside = false;
|
||||
private boolean mouseDown = false;
|
||||
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
if (comboBox.isEditable()) {
|
||||
if (e.getComponent() == arrowButton) {
|
||||
mouseInside = true;
|
||||
}
|
||||
} else {
|
||||
mouseInside = true;
|
||||
comboBox.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
public void mouseExited(MouseEvent e) {
|
||||
if (comboBox.isEditable()) {
|
||||
if (e.getComponent() == arrowButton) {
|
||||
mouseInside = false;
|
||||
}
|
||||
} else {
|
||||
mouseInside = false;
|
||||
comboBox.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
public void mousePressed(MouseEvent e) {
|
||||
if (comboBox.isEditable()) {
|
||||
if (e.getComponent() == arrowButton) {
|
||||
mouseDown = true;
|
||||
}
|
||||
} else {
|
||||
mouseDown = true;
|
||||
comboBox.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
if (comboBox.isEditable()) {
|
||||
if (e.getComponent() == arrowButton) {
|
||||
mouseDown = false;
|
||||
}
|
||||
} else {
|
||||
mouseDown = false;
|
||||
comboBox.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
// =================================================================================================================
|
||||
// LayoutManager
|
||||
private class ComboLayout implements LayoutManager {
|
||||
|
||||
public void addLayoutComponent(String name, Component comp) {
|
||||
}
|
||||
|
||||
public void removeLayoutComponent(Component comp) {
|
||||
}
|
||||
|
||||
public Dimension preferredLayoutSize(Container parent) {
|
||||
return parent.getPreferredSize();
|
||||
}
|
||||
|
||||
public Dimension minimumLayoutSize(Container parent) {
|
||||
return parent.getMinimumSize();
|
||||
}
|
||||
|
||||
public void layoutContainer(Container parent) {
|
||||
JComboBox cb = (JComboBox) parent;
|
||||
int width = cb.getWidth();
|
||||
|
||||
Insets insets = getInsets();
|
||||
Rectangle cvb;
|
||||
|
||||
if (arrowButton != null) {
|
||||
if (cb.getComponentOrientation().isLeftToRight()) {
|
||||
arrowButton.setBounds(width - (insets.right + btnSize.width),
|
||||
insets.top,
|
||||
btnSize.width, btnSize.height);
|
||||
} else {
|
||||
arrowButton.setBounds(insets.left, insets.top,
|
||||
btnSize.width, btnSize.height);
|
||||
}
|
||||
}
|
||||
if (editor != null) {
|
||||
cvb = rectangleForCurrentValue();
|
||||
editor.setBounds(cvb.x, cvb.y, cvb.width, cvb.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.lookandfeel.ui;
|
||||
|
||||
/*
|
||||
* $Id: NimbusGraphicsUtils.java,v 1.9 2005/12/05 15:00:55 kizune Exp $
|
||||
*
|
||||
* Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
|
||||
* Santa Clara, California 95054, U.S.A. All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
import javax.swing.DefaultListCellRenderer;
|
||||
import javax.swing.JList;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
|
||||
/**
|
||||
* NimbusListCellRender
|
||||
*
|
||||
* @author Created by Jasper Potts (Jan 19, 2007)
|
||||
* @version 1.0
|
||||
*/
|
||||
public class ListCellRender extends DefaultListCellRenderer {
|
||||
|
||||
@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
|
||||
boolean cellHasFocus) {
|
||||
setOpaque(true);
|
||||
setBackground(Color.magenta);
|
||||
return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.lookandfeel.ui;
|
||||
|
||||
import static org.jackhuang.hellominecraft.lookandfeel.GraphicsUtils.loadImage;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JScrollBar;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import javax.swing.plaf.metal.MetalScrollBarUI;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.geom.AffineTransform;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
/**
|
||||
* NimbusScrollBarUI - A custom scrollbar ui for nimbus. It is special as it handles all the painting for the buttons as
|
||||
* well so that it can cope with the buttons being non-recangular.
|
||||
*
|
||||
* @author Created by Jasper Potts (Jan 17, 2007)
|
||||
* @version 1.0
|
||||
*/
|
||||
public class ScrollBarUI extends MetalScrollBarUI {
|
||||
|
||||
private static final BufferedImage BACKGROUND_ENABLED = loadImage("scroll_enabled.png");
|
||||
private static final BufferedImage BACKGROUND_DISABLED = loadImage("scroll_disabled.png");
|
||||
private static final BufferedImage SCROLL_DEC_NORMAL = loadImage("scroll_dec_normal.png");
|
||||
private static final BufferedImage SCROLL_DEC_OVER = loadImage("scroll_dec_over.png");
|
||||
private static final BufferedImage SCROLL_DEC_PRESSED = loadImage("scroll_dec_pressed.png");
|
||||
private static final BufferedImage SCROLL_INC_NORMAL = loadImage("scroll_inc_normal.png");
|
||||
private static final BufferedImage SCROLL_INC_OVER = loadImage("scroll_inc_over.png");
|
||||
private static final BufferedImage SCROLL_INC_PRESSED = loadImage("scroll_inc_pressed.png");
|
||||
private static final BufferedImage SCROLL_THUMB_NORMAL = loadImage("scroll_thumb_normal.png");
|
||||
private static final BufferedImage SCROLL_THUMB_OVER = loadImage("scroll_thumb_over.png");
|
||||
private static final BufferedImage SCROLL_THUMB_PRESSED = loadImage("scroll_thumb_pressed.png");
|
||||
|
||||
private boolean incBtnMouseOver, incBtnMousePressed;
|
||||
private boolean decBtnMouseOver, decBtnMousePressed;
|
||||
private boolean thumbMousePressed;
|
||||
|
||||
/**
|
||||
* Creates a new UI deligate for the given component. It is a standard method that all UI deligates must have.
|
||||
*
|
||||
* @param c The component that the UI is for
|
||||
* @return a new instance of NimbusScrollBarUI
|
||||
*/
|
||||
public static ComponentUI createUI(JComponent c) {
|
||||
return new ScrollBarUI();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override public void installUI(JComponent c) {
|
||||
super.installUI(c);
|
||||
c.setOpaque(true);
|
||||
c.addMouseListener(new MouseAdapter() {
|
||||
@Override public void mousePressed(MouseEvent e) {
|
||||
if (isThumbRollover()) {
|
||||
thumbMousePressed = true;
|
||||
scrollbar.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void mouseReleased(MouseEvent e) {
|
||||
thumbMousePressed = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override protected Dimension getMinimumThumbSize() {
|
||||
return new Dimension(15, 15);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override protected JButton createDecreaseButton(int orientation) {
|
||||
decreaseButton = new ScrollButton(orientation, scrollBarWidth, isFreeStanding);
|
||||
decreaseButton.addMouseListener(new MouseAdapter() {
|
||||
@Override public void mouseEntered(MouseEvent e) {
|
||||
decBtnMouseOver = true;
|
||||
}
|
||||
|
||||
@Override public void mouseExited(MouseEvent e) {
|
||||
decBtnMouseOver = false;
|
||||
}
|
||||
|
||||
@Override public void mousePressed(MouseEvent e) {
|
||||
decBtnMousePressed = true;
|
||||
}
|
||||
|
||||
@Override public void mouseReleased(MouseEvent e) {
|
||||
decBtnMousePressed = false;
|
||||
}
|
||||
});
|
||||
return decreaseButton;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override protected JButton createIncreaseButton(int orientation) {
|
||||
increaseButton = new ScrollButton(orientation, scrollBarWidth, isFreeStanding);
|
||||
increaseButton.addMouseListener(new MouseAdapter() {
|
||||
@Override public void mouseEntered(MouseEvent e) {
|
||||
incBtnMouseOver = true;
|
||||
}
|
||||
|
||||
@Override public void mouseExited(MouseEvent e) {
|
||||
incBtnMouseOver = false;
|
||||
}
|
||||
|
||||
@Override public void mousePressed(MouseEvent e) {
|
||||
incBtnMousePressed = true;
|
||||
}
|
||||
|
||||
@Override public void mouseReleased(MouseEvent e) {
|
||||
incBtnMousePressed = false;
|
||||
}
|
||||
});
|
||||
return increaseButton;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds) {
|
||||
BufferedImage decImg =
|
||||
decBtnMousePressed ? SCROLL_DEC_PRESSED : decBtnMouseOver ? SCROLL_DEC_OVER : SCROLL_DEC_NORMAL;
|
||||
BufferedImage incImg =
|
||||
incBtnMousePressed ? SCROLL_INC_PRESSED : incBtnMouseOver ? SCROLL_INC_OVER : SCROLL_INC_NORMAL;
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
AffineTransform origTransform = g2.getTransform();
|
||||
int scrollWidth = scrollbar.getWidth();
|
||||
if (scrollbar.getOrientation() == JScrollBar.VERTICAL) {
|
||||
scrollWidth = scrollbar.getHeight();
|
||||
g2.scale(1, -1);
|
||||
g2.rotate(-Math.PI / 2, 0, 0);
|
||||
}
|
||||
// draw track & bottons
|
||||
if (scrollbar.isEnabled()) {
|
||||
g.drawImage(decImg, 0, 0, scrollbar);
|
||||
//g.drawImage(BACKGROUND_ENABLED, 15, 0, scrollWidth - 15, 15, 0, 0, 1, 15, scrollbar);
|
||||
g.drawImage(incImg, scrollWidth - 15, 0, scrollbar);
|
||||
} else {
|
||||
//g.drawImage(BACKGROUND_DISABLED, 0, 0, scrollWidth, 15, 0, 0, 1, 15, scrollbar);
|
||||
}
|
||||
// undo any transform
|
||||
g2.setTransform(origTransform);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) {
|
||||
if (scrollbar.isEnabled()) {
|
||||
BufferedImage thumbImg = thumbMousePressed ? SCROLL_THUMB_PRESSED :
|
||||
isThumbRollover() ? SCROLL_THUMB_OVER : SCROLL_THUMB_NORMAL;
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
AffineTransform origTransform = g2.getTransform();
|
||||
Rectangle b = thumbBounds;
|
||||
if (scrollbar.getOrientation() == JScrollBar.VERTICAL) {
|
||||
b = new Rectangle(thumbBounds.y, thumbBounds.x, thumbBounds.height, thumbBounds.width);
|
||||
g2.scale(1, -1);
|
||||
g2.rotate(-Math.PI / 2, 0, 0);
|
||||
}
|
||||
g.drawImage(thumbImg,
|
||||
b.x, b.y, b.x + 14, b.y + 15,
|
||||
0, 0, 14, 15, scrollbar);
|
||||
g.drawImage(thumbImg,
|
||||
b.x + 14, b.y, b.x + b.width - 14, b.y + 15,
|
||||
16, 0, 17, 15, scrollbar);
|
||||
g.drawImage(thumbImg,
|
||||
b.x + b.width - 14, b.y, b.x + b.width, b.y + 15,
|
||||
24, 0, 38, 15, scrollbar);
|
||||
// undo any transform
|
||||
g2.setTransform(origTransform);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.jackhuang.hellominecraft.lookandfeel.ui;
|
||||
|
||||
/*
|
||||
* $Id: NimbusGraphicsUtils.java,v 1.9 2005/12/05 15:00:55 kizune Exp $
|
||||
*
|
||||
* Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
|
||||
* Santa Clara, California 95054, U.S.A. All rights reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
import static javax.swing.SwingConstants.NORTH;
|
||||
import static javax.swing.SwingConstants.SOUTH;
|
||||
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.plaf.metal.MetalScrollButton;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
|
||||
/**
|
||||
* NimbusScrollButton - a fixed size 15x17 vertical 17x15 horizontal transparent button.
|
||||
*
|
||||
* @author Created by Jasper Potts (Jan 17, 2007)
|
||||
* @version 1.0
|
||||
*/
|
||||
public class ScrollButton extends MetalScrollButton implements SwingConstants {
|
||||
|
||||
private final int btnWidth, btnHeight;
|
||||
|
||||
ScrollButton(int direction, int width, boolean freeStanding) {
|
||||
super(direction, width, freeStanding);
|
||||
setOpaque(false);
|
||||
if (direction == NORTH || direction == SOUTH) {
|
||||
btnWidth = 15;
|
||||
btnHeight = 17;
|
||||
} else {
|
||||
btnWidth = 17;
|
||||
btnHeight = 15;
|
||||
}
|
||||
}
|
||||
|
||||
@Override public Dimension getMaximumSize() {
|
||||
return this.getPreferredSize();
|
||||
}
|
||||
|
||||
@Override public Dimension getMinimumSize() {
|
||||
return this.getPreferredSize();
|
||||
}
|
||||
|
||||
@Override public Dimension getPreferredSize() {
|
||||
return new Dimension(btnWidth, btnHeight);
|
||||
}
|
||||
|
||||
@Override public void repaint(long tm, int x, int y, int width, int height) {
|
||||
if (getParent() != null) getParent().repaint();
|
||||
}
|
||||
|
||||
/**
|
||||
* Don't paint anything as all painting is done by the scrollbar
|
||||
*
|
||||
* @param g {@inheritDoc}
|
||||
*/
|
||||
@Override public void paint(Graphics g) {
|
||||
}
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 141 B |
|
After Width: | Height: | Size: 141 B |
|
After Width: | Height: | Size: 141 B |
|
After Width: | Height: | Size: 143 B |
|
After Width: | Height: | Size: 436 B |
|
After Width: | Height: | Size: 324 B |
|
After Width: | Height: | Size: 415 B |
|
After Width: | Height: | Size: 327 B |
|
After Width: | Height: | Size: 224 B |
|
After Width: | Height: | Size: 241 B |
|
After Width: | Height: | Size: 230 B |
|
After Width: | Height: | Size: 273 B |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 433 B |
|
After Width: | Height: | Size: 457 B |
|
After Width: | Height: | Size: 590 B |
|
After Width: | Height: | Size: 491 B |
|
After Width: | Height: | Size: 534 B |
|
After Width: | Height: | Size: 578 B |
|
After Width: | Height: | Size: 632 B |
|
After Width: | Height: | Size: 664 B |
|
After Width: | Height: | Size: 243 B |
|
After Width: | Height: | Size: 241 B |
|
After Width: | Height: | Size: 243 B |
|
After Width: | Height: | Size: 147 B |
|
After Width: | Height: | Size: 151 B |
|
After Width: | Height: | Size: 252 B |
|
After Width: | Height: | Size: 236 B |
|
After Width: | Height: | Size: 252 B |
|
After Width: | Height: | Size: 200 B |
|
After Width: | Height: | Size: 200 B |
|
After Width: | Height: | Size: 200 B |
@@ -0,0 +1,424 @@
|
||||
<synth>
|
||||
|
||||
<!-- ########################################################################################################### -->
|
||||
<!-- TOP LEVEL CONTAINERS -->
|
||||
<!-- ########################################################################################################### -->
|
||||
|
||||
<style id="default">
|
||||
<state>
|
||||
<color value="#000000" type="FOREGROUND"/>
|
||||
<color value="#9CC5D8" type="TEXT_BACKGROUND"/>
|
||||
<font name="微软雅黑" size="12" />
|
||||
</state>
|
||||
<object id="GraphicsUtils" class="org.jackhuang.hellominecraft.lookandfeel.GraphicsUtils"/>
|
||||
<graphicsUtils idref="GraphicsUtils"/>
|
||||
</style>
|
||||
<bind style="default" type="region" key=".*"/>
|
||||
|
||||
<style id="RootPane">
|
||||
<state>
|
||||
<color value="#ffffff" type="BACKGROUND"/>
|
||||
<opaque value="true"/>
|
||||
</state>
|
||||
</style>
|
||||
<bind style="RootPane" type="region" key="RootPane"/>
|
||||
|
||||
<!-- ########################################################################################################### -->
|
||||
<!-- SCROLL BARS & VIEW PORT -->
|
||||
<!-- ########################################################################################################### -->
|
||||
|
||||
<defaultsProperty key="ScrollBarUI" type="string" value="org.jackhuang.hellominecraft.lookandfeel.ui.ScrollBarUI"/>
|
||||
<defaultsProperty key="ScrollBar.width" type="integer" value="15"/>
|
||||
<defaultsProperty key="ScrollBar.minimumThumbSize" type="dimension" value="29 29"/>
|
||||
<defaultsProperty key="ScrollBar.maximumThumbSize" type="dimension" value="1000 1000"/>
|
||||
|
||||
<style id="Viewport">
|
||||
<insets top="0" left="0" bottom="0" right="0"/>
|
||||
</style>
|
||||
<bind style="Viewport" type="region" key="Viewport"/>
|
||||
|
||||
<!-- ########################################################################################################### -->
|
||||
<!-- BUTTONS -->
|
||||
<!-- ########################################################################################################### -->
|
||||
|
||||
<style id="button">
|
||||
<object id="ButtonPainter" class="org.jackhuang.hellominecraft.lookandfeel.painters.ButtonPainter"/>
|
||||
<painter idref="ButtonPainter"/>
|
||||
<state value="DISABLED">
|
||||
<color value="#ACAEB2" type="TEXT_FOREGROUND"/>
|
||||
</state>
|
||||
<state value="DEFAULT AND PRESSED">
|
||||
<color value="#000000" type="TEXT_FOREGROUND"/>
|
||||
</state>
|
||||
<property key="Button.margin" type="insets" value="4 12 5 12"/>
|
||||
</style>
|
||||
<bind style="button" type="region" key="Button"/>
|
||||
<style id="togglebutton">
|
||||
<object id="ButtonPainter" class="org.jackhuang.hellominecraft.lookandfeel.painters.ButtonPainter"/>
|
||||
<painter idref="ButtonPainter"/>
|
||||
<state value="DISABLED">
|
||||
<color value="#ACAEB2" type="TEXT_FOREGROUND"/>
|
||||
</state>
|
||||
<state value="PRESSED">
|
||||
<color value="#000000" type="TEXT_FOREGROUND"/>
|
||||
</state>
|
||||
<state value="SELECTED">
|
||||
<color value="#000000" type="TEXT_FOREGROUND"/>
|
||||
</state>
|
||||
<property key="ToggleButton.margin" type="insets" value="4 12 5 12"/>
|
||||
</style>
|
||||
<bind style="togglebutton" type="region" key="ToggleButton"/>
|
||||
|
||||
<style id="checkbox">
|
||||
<insets top="1" left="1" bottom="1" right="1"/>
|
||||
<imageIcon id="check_off" path="images/checkbox_off.png"/>
|
||||
<imageIcon id="check_off_over" path="images/checkbox_off_over.png"/>
|
||||
<imageIcon id="check_off_pressed" path="images/checkbox_off_pressed.png"/>
|
||||
<imageIcon id="check_off_disabled" path="images/checkbox_off_disabled.png"/>
|
||||
<imageIcon id="check_on" path="images/checkbox_on.png"/>
|
||||
<imageIcon id="check_on_over" path="images/checkbox_on_over.png"/>
|
||||
<imageIcon id="check_on_pressed" path="images/checkbox_on_pressed.png"/>
|
||||
<imageIcon id="check_on_disabled" path="images/checkbox_on_disabled.png"/>
|
||||
<property key="CheckBox.icon" value="check_off"/>
|
||||
<state value="DISABLED and SELECTED">
|
||||
<property key="CheckBox.icon" value="check_on_disabled"/>
|
||||
</state>
|
||||
<state value="DISABLED">
|
||||
<property key="CheckBox.icon" value="check_off_disabled"/>
|
||||
</state>
|
||||
<state value="PRESSED">
|
||||
<property key="CheckBox.icon" value="check_off_pressed"/>
|
||||
</state>
|
||||
<state value="MOUSE_OVER">
|
||||
<property key="CheckBox.icon" value="check_off_over"/>
|
||||
</state>
|
||||
<state value="SELECTED and PRESSED">
|
||||
<property key="CheckBox.icon" value="check_on_pressed"/>
|
||||
</state>
|
||||
<state value="SELECTED and MOUSE_OVER">
|
||||
<property key="CheckBox.icon" value="check_on_over"/>
|
||||
</state>
|
||||
<state value="SELECTED">
|
||||
<property key="CheckBox.icon" value="check_on"/>
|
||||
</state>
|
||||
</style>
|
||||
<bind style="checkbox" type="region" key="Checkbox"/>
|
||||
|
||||
<style id="radiobutton">
|
||||
<insets top="2" left="2" bottom="2" right="2"/>
|
||||
<imageIcon id="radio_off" path="images/radio_btn.png"/>
|
||||
<imageIcon id="radio_off_over" path="images/radio_btn_over.png"/>
|
||||
<imageIcon id="radio_off_pressed" path="images/radio_btn_pressed.png"/>
|
||||
<imageIcon id="radio_off_disabled" path="images/radio_btn_disabled_normal.png"/>
|
||||
<imageIcon id="radio_on" path="images/radio_btn_selected.png"/>
|
||||
<imageIcon id="radio_on_over" path="images/radio_btn_selected_over.png"/>
|
||||
<imageIcon id="radio_on_pressed" path="images/radio_btn_selected_pressed.png"/>
|
||||
<imageIcon id="radio_on_disabled" path="images/radio_btn_disabled_selected.png"/>
|
||||
<property key="RadioButton.icon" value="radio_off"/>
|
||||
<state value="DISABLED and SELECTED">
|
||||
<property key="RadioButton.icon" value="radio_on_disabled"/>
|
||||
</state>
|
||||
<state value="DISABLED">
|
||||
<property key="RadioButton.icon" value="radio_off_disabled"/>
|
||||
</state>
|
||||
<state value="PRESSED">
|
||||
<property key="RadioButton.icon" value="radio_off_pressed"/>
|
||||
</state>
|
||||
<state value="MOUSE_OVER">
|
||||
<property key="RadioButton.icon" value="radio_off_over"/>
|
||||
</state>
|
||||
<state value="SELECTED and PRESSED">
|
||||
<property key="RadioButton.icon" value="radio_on_pressed"/>
|
||||
</state>
|
||||
<state value="SELECTED and MOUSE_OVER">
|
||||
<property key="RadioButton.icon" value="radio_on_over"/>
|
||||
</state>
|
||||
<state value="SELECTED">
|
||||
<property key="RadioButton.icon" value="radio_on"/>
|
||||
</state>
|
||||
</style>
|
||||
<bind style="radiobutton" type="region" key="RadioButton"/>
|
||||
|
||||
<!-- ########################################################################################################### -->
|
||||
<!-- TEXT FIELDS -->
|
||||
<!-- ########################################################################################################### -->
|
||||
|
||||
<style id="textfield">
|
||||
<object id="TextFieldPainter" class="org.jackhuang.hellominecraft.lookandfeel.painters.TextFieldPainter"/>
|
||||
<painter idref="TextFieldPainter"/>
|
||||
<state>
|
||||
<font name="微软雅黑" size="12" />
|
||||
<color value="#000000" type="TEXT_FOREGROUND"/>
|
||||
</state>
|
||||
<insets top="4" left="6" bottom="4" right="6"/>
|
||||
</style>
|
||||
<bind style="textfield" type="region" key="TextField"/>
|
||||
<bind style="textfield" type="region" key="TextArea"/>
|
||||
<bind style="textfield" type="region" key="PasswordField"/>
|
||||
|
||||
<!-- ########################################################################################################### -->
|
||||
<!-- SCROLL PANE -->
|
||||
<!-- ########################################################################################################### -->
|
||||
|
||||
<style id="scrollpane">
|
||||
<object id="TextFieldPainter" class="org.jackhuang.hellominecraft.lookandfeel.painters.TextFieldPainter"/>
|
||||
<painter idref="TextFieldPainter"/>
|
||||
<insets top="4" left="6" bottom="4" right="6"/>
|
||||
</style>
|
||||
<bind style="scrollpane" type="region" key="ScrollPane"/>
|
||||
|
||||
<!-- ########################################################################################################### -->
|
||||
<!-- MENUS -->
|
||||
<!-- ########################################################################################################### -->
|
||||
|
||||
<style id="MenuBar">
|
||||
<insets top="2" left="6" bottom="2" right="6"/>
|
||||
</style>
|
||||
<bind style="MenuBar" type="region" key="MenuBar"/>
|
||||
|
||||
<style id="Menu">
|
||||
<insets top="2" left="2" bottom="3" right="2"/>
|
||||
<state>
|
||||
<color value="#000000" type="TEXT_FOREGROUND"/>
|
||||
<color value="#FFFFFF" type="BACKGROUND"/>
|
||||
</state>
|
||||
</style>
|
||||
<bind style="Menu" type="region" key="Menu"/>
|
||||
|
||||
<style id="MenuItem">
|
||||
<insets top="2" left="2" bottom="3" right="2"/>
|
||||
<opaque value="true"/>
|
||||
<state>
|
||||
<color value="#000000" type="TEXT_FOREGROUND"/>
|
||||
<color value="#FFFFFF" type="BACKGROUND"/>
|
||||
</state>
|
||||
<state value="DISABLED">
|
||||
<color value="#FFFFFF" type="BACKGROUND"/>
|
||||
<color value="#D8D8D9" type="TEXT_FOREGROUND"/>
|
||||
</state>
|
||||
<state value="MOUSE_OVER">
|
||||
<color value="#000000" type="TEXT_FOREGROUND"/>
|
||||
<color value="#C2E6F6" type="BACKGROUND"/>
|
||||
</state>
|
||||
<state value="SELECTED">
|
||||
<color value="#000000" type="TEXT_FOREGROUND"/>
|
||||
<color value="#E85D00" type="BACKGROUND"/>
|
||||
</state>
|
||||
</style>
|
||||
<bind style="MenuItem" type="region" key="MenuItem"/>
|
||||
|
||||
<style id="PopupMenuSeparator">
|
||||
<insets top="2" left="0" bottom="2" right="0"/>
|
||||
</style>
|
||||
<bind style="PopupMenuSeparator" type="region" key="PopupMenuSeparator"/>
|
||||
|
||||
<style id="PopupMenu">
|
||||
<insets top="6" left="1" bottom="6" right="1"/>
|
||||
</style>
|
||||
<bind style="PopupMenu" type="region" key="PopupMenu"/>
|
||||
|
||||
<!-- ########################################################################################################### -->
|
||||
<!-- PROGRESS BARS -->
|
||||
<!-- ########################################################################################################### -->
|
||||
|
||||
<style id="progress">
|
||||
<object id="ProgressPainter" class="org.jackhuang.hellominecraft.lookandfeel.painters.ProgressPainter"/>
|
||||
<painter idref="ProgressPainter"/>
|
||||
<property key="ProgressBar.horizontalSize" type="dimension" value="50 20"/>
|
||||
<property key="ProgressBar.vertictalSize" type="dimension" value="20 50"/>
|
||||
</style>
|
||||
<bind style="progress" type="region" key="ProgressBar"/>
|
||||
|
||||
<!-- ########################################################################################################### -->
|
||||
<!-- TABBED PANE -->
|
||||
<!-- ########################################################################################################### -->
|
||||
|
||||
<style id="TabbedPaneTab">
|
||||
<insets top="4" left="8" right="8" bottom="4"/>
|
||||
<state>
|
||||
<font name="微软雅黑" size="14" />
|
||||
<color type="TEXT_FOREGROUND" value="#000000" />
|
||||
</state>
|
||||
<state value="SELECTED">
|
||||
<color type="TEXT_FOREGROUND" value="#106CA3" />
|
||||
</state>
|
||||
</style>
|
||||
<bind style="TabbedPaneTab" type="region" key="TabbedPaneTab"/>
|
||||
<style id="TabbedPaneTabArea">
|
||||
<insets top="3" left="10" right="10" bottom="5"/>
|
||||
</style>
|
||||
<bind style="TabbedPaneTabArea" type="region" key="TabbedPaneTabArea"/>
|
||||
|
||||
<!-- ########################################################################################################### -->
|
||||
<!-- COMBO BOX -->
|
||||
<!-- ########################################################################################################### -->
|
||||
|
||||
<object class="javax.swing.plaf.ColorUIResource" id="ComboBox.background">
|
||||
<int>237</int>
|
||||
<int>239</int>
|
||||
<int>242</int>
|
||||
</object>
|
||||
<defaultsProperty key="ComboBox.background" type="idref" value="ComboBox.background"/>
|
||||
<object class="javax.swing.plaf.ColorUIResource" id="ComboBox.selectionForeground">
|
||||
<int>0</int>
|
||||
<int>0</int>
|
||||
<int>0</int>
|
||||
</object>
|
||||
<defaultsProperty key="ComboBox.selectionForeground" type="idref" value="ComboBox.selectionForeground"/>
|
||||
<object class="javax.swing.plaf.ColorUIResource" id="ComboBox.selectionBackground">
|
||||
<int>160</int>
|
||||
<int>216</int>
|
||||
<int>240</int>
|
||||
</object>
|
||||
<defaultsProperty key="ComboBox.selectionBackground" type="idref" value="ComboBox.selectionBackground"/>
|
||||
<object class="javax.swing.plaf.ColorUIResource" id="ComboBox.foreground">
|
||||
<int>35</int>
|
||||
<int>35</int>
|
||||
<int>36</int>
|
||||
</object>
|
||||
<defaultsProperty key="ComboBox.foreground" type="idref" value="ComboBox.foreground"/>
|
||||
|
||||
<style id="combobox">
|
||||
<state value="SELECTED">
|
||||
<color type="BACKGROUND" value="#A0D8F0" />
|
||||
<color type="TEXT_FOREGROUND" value="#70C5E9" />
|
||||
</state>
|
||||
<state>
|
||||
<color type="BACKGROUND" value="#A0D8F0" />
|
||||
<color type="TEXT_FOREGROUND" value="#70C5E9" />
|
||||
</state>
|
||||
<property key="ComboBox.rendererUseListColors" type="boolean" value="false"/>
|
||||
</style>
|
||||
<style id="Combo listRenderer">
|
||||
<insets top="2" left="2" bottom="3" right="2"/>
|
||||
<opaque value="true"/>
|
||||
<state value="DISABLED">
|
||||
<color value="#EDEFF2" type="BACKGROUND"/>
|
||||
<color value="#8E8F91" type="TEXT_FOREGROUND"/>
|
||||
</state>
|
||||
<state value="ENABLED">
|
||||
<color value="#000000" type="TEXT_FOREGROUND"/>
|
||||
<color value="#A0D8F0" type="BACKGROUND"/>
|
||||
</state>
|
||||
<state value="SELECTED">
|
||||
<color type="BACKGROUND" value="#A0D8F0" />
|
||||
<color type="TEXT_FOREGROUND" value="#70C5E9" />
|
||||
</state>
|
||||
</style>
|
||||
<bind style="combobox" type="region" key="ComboBox" />
|
||||
<bind style="Combo listRenderer" type="name" key="ComboBox.listRenderer"/>
|
||||
|
||||
<defaultsProperty key="ComboBoxUI" type="string" value="org.jackhuang.hellominecraft.lookandfeel.ui.ComboBoxUI"/>
|
||||
|
||||
<!-- ########################################################################################################### -->
|
||||
<!-- LIST -->
|
||||
<!-- ########################################################################################################### -->
|
||||
|
||||
<style id="List">
|
||||
<state>
|
||||
<color value="#000000" type="TEXT_FOREGROUND"/>
|
||||
</state>
|
||||
<state value="SELECTED">
|
||||
<color value="#000000" type="TEXT_FOREGROUND"/>
|
||||
<color value="#E85D00" type="BACKGROUND"/>
|
||||
</state>
|
||||
<state value="DISABLED">
|
||||
<color value="#C1C1C1" type="TEXT_FOREGROUND"/>
|
||||
</state>
|
||||
<state value="MOUSE_OVER">
|
||||
<color value="#000000" type="TEXT_FOREGROUND"/>
|
||||
<color value="#A0D8F0" type="BACKGROUND"/>
|
||||
</state>
|
||||
<property key="List.rendererUseListColors" type="boolean" value="false"/>
|
||||
</style>
|
||||
<bind style="List" type="region" key="List" />
|
||||
<style id="List listRenderer">
|
||||
<insets top="2" left="2" bottom="3" right="2"/>
|
||||
<opaque value="true"/>
|
||||
<state>
|
||||
<color value="#232324" type="TEXT_FOREGROUND"/>
|
||||
<color value="#EDEFF2" type="BACKGROUND"/>
|
||||
</state>
|
||||
<state value="DISABLED">
|
||||
<color value="#EDEFF2" type="BACKGROUND"/>
|
||||
<color value="#8E8F91" type="TEXT_FOREGROUND"/>
|
||||
</state>
|
||||
<state value="MOUSE_OVER">
|
||||
<color value="#FFFFFF" type="TEXT_FOREGROUND"/>
|
||||
<color value="#3A698A" type="BACKGROUND"/>
|
||||
</state>
|
||||
</style>
|
||||
<bind style="List listRenderer" type="name" key="List.listRenderer"/>
|
||||
|
||||
|
||||
<object class="javax.swing.plaf.ColorUIResource" id="List.background">
|
||||
<int>237</int>
|
||||
<int>239</int>
|
||||
<int>242</int>
|
||||
</object>
|
||||
<defaultsProperty key="List.background" type="idref" value="List.background"/>
|
||||
<object class="javax.swing.plaf.ColorUIResource" id="List.selectionForeground">
|
||||
<int>255</int>
|
||||
<int>255</int>
|
||||
<int>255</int>
|
||||
</object>
|
||||
<defaultsProperty key="List.selectionForeground" type="idref" value="List.selectionForeground"/>
|
||||
<object class="javax.swing.plaf.ColorUIResource" id="ListSelectionBackground">
|
||||
<int>0</int>
|
||||
<int>0</int>
|
||||
<int>255</int>
|
||||
</object>
|
||||
<defaultsProperty key="List.selectionBackground" type="idref" value="ListSelectionBackground"/>
|
||||
<object class="javax.swing.plaf.ColorUIResource" id="List.foreground">
|
||||
<int>35</int>
|
||||
<int>35</int>
|
||||
<int>36</int>
|
||||
</object>
|
||||
<defaultsProperty key="List.foreground" type="idref" value="List.foreground"/>
|
||||
|
||||
<defaultsProperty key="List.rendererUseListColors" type="boolean" value="false"/>
|
||||
|
||||
<!-- ########################################################################################################### -->
|
||||
<!-- OPTION PANE -->
|
||||
<!-- ########################################################################################################### -->
|
||||
|
||||
<style id="OptionPane">
|
||||
<imageIcon id="infoIcon" path="images/option_pane_info.png"/>
|
||||
<property key="OptionPane.informationIcon" value="infoIcon"/>
|
||||
<imageIcon id="errorIcon" path="images/option_pane_error.png"/>
|
||||
<property key="OptionPane.errorIcon" value="errorIcon"/>
|
||||
<imageIcon id="warningIcon" path="images/option_pane_warning.png"/>
|
||||
<property key="OptionPane.warningIcon" value="warningIcon"/>
|
||||
<imageIcon id="questionIcon" path="images/option_pane_question.png"/>
|
||||
<property key="OptionPane.questionIcon" value="questionIcon"/>
|
||||
<property key="OptionPane.buttonOrientation" type="integer" value="4"/>
|
||||
<property key="OptionPane.isYesLast" type="boolean" value="false"/>
|
||||
</style>
|
||||
<bind style="OptionPane" type="region" key="OptionPane"/>
|
||||
|
||||
<style id="table">
|
||||
<object class="javax.swing.plaf.ColorUIResource" id="color">
|
||||
<int>255</int>
|
||||
<int>0</int>
|
||||
<int>0</int>
|
||||
</object>
|
||||
<defaultsProperty key="Table.focusCellForeground" type="idref" value="color"/>
|
||||
<object class="javax.swing.plaf.ColorUIResource" id="gridColor">
|
||||
<int>30</int>
|
||||
<int>123</int>
|
||||
<int>135</int>
|
||||
</object>
|
||||
<defaultsProperty key="Table.gridColor" type="idref" value="gridColor"/>
|
||||
<defaultsProperty key="Table.selectionBackground" type="idref" value="gridColor"/>
|
||||
<defaultsProperty key="Table.selectionForeground" type="idref" value="gridColor"/>
|
||||
<defaultsProperty key="Table.background" type="idref" value="gridColor"/>
|
||||
</style>
|
||||
<bind style="table" type="region" key="Table"/>
|
||||
<style id="defaultBackground">
|
||||
<state>
|
||||
<color value="#F1F2F2" type="BACKGROUND"></color>
|
||||
<color value="#000000" type="TEXT_FOREGROUND"></color>
|
||||
</state>
|
||||
</style>
|
||||
<bind style="defaultBackground" type="region" key="Table.*"/>
|
||||
</synth>
|
||||