Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
789 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
vendor = 'Java Swing Tips - https://ateraimemo.com/' | ||
version = '1.0.0' | ||
year = '2003-2017' | ||
|
||
main.class = 'example.MainPanel' | ||
runtime.classpath = '.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project> | ||
<property name="jnlp.title" value="JST SliderFocusBorder" /> | ||
<property name="jnlp.Name" value="SliderFocusBorder" /> | ||
<property name="jnlp.name" value="sliderfocusborder" /> | ||
<property name="jnlp.codebase" value="https://ateraimemo.com/swing/sliderfocusborder/" /> | ||
<property name="jnlp.homepage" value="https://ateraimemo.com/Swing/SliderFocusBorder.html" /> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project> | ||
<!-- project --> | ||
<property name="Name" value="Example" /> | ||
<property name="name" value="example" /> | ||
<property name="vendor" value="Java Swing Tips - https://ateraimemo.com/" /> | ||
<property name="version" value="1.0.0" /> | ||
<property name="year" value="2003-2017" /> | ||
|
||
<!-- class --> | ||
<property name="main.class" value="example.MainPanel" /> | ||
<property name="runtime.classpath" value="." /> | ||
|
||
<!-- compile --> | ||
<property name="compile.debug" value="on" /> | ||
<property name="compile.optimize" value="on" /> | ||
<property name="compile.nowarn" value="off" /> | ||
<property name="compile.deprecation" value="on" /> | ||
<property name="compile.verbose" value="off" /> | ||
<property name="compile.source" value="1.8" /> | ||
<property name="compile.encoding" value="UTF-8" /> | ||
|
||
<!-- javadoc --> | ||
<property name="javadoc.encoding" value="UTF-8" /> | ||
<property name="javadoc.docencoding" value="UTF-8" /> | ||
<property name="javadoc.pkgs" value="*" /> | ||
<property name="javadoc.locale" value="ja" /> | ||
<property name="javadoc.link" value="https://docs.oracle.com/javase/jp/8/docs/api/" /> | ||
|
||
<!-- signjar --> | ||
<property name="signjar.keystore" value="myKeyStore" /> | ||
<property name="signjar.alias" value="myAlias" /> | ||
|
||
<!-- directory --> | ||
<property name="lib.dir" value="lib" /> | ||
<property name="src.dir" value="src/java" /> | ||
<property name="res.dir" value="src/conf" /> | ||
<property name="web.dir" value="src/web" /> | ||
<property name="conf.dir" value="src/conf" /> | ||
<property name="bkup.dir" value="bkuptmp" /> | ||
|
||
<!-- target --> | ||
<property name="build.dir" value="target" /> | ||
<property name="build.src" value="${build.dir}/src" /> | ||
<property name="build.dest" value="${build.dir}/classes" /> | ||
<property name="build.docs" value="${build.dir}/apidocs" /> | ||
<property name="build.reports" value="${build.dir}/reports" /> | ||
<property name="build.correctreports" value="${build.dir}/correctreports" /> | ||
<property name="build.res" value="${build.dest}/resources" /> | ||
<property name="build.conf" value="${build.dest}/conf" /> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@echo off | ||
setlocal | ||
echo Swing Example | ||
echo ------------------- | ||
|
||
if "%JAVA_HOME%" == "" goto :error | ||
set MAIN_CLASS=example.MainPanel | ||
set CLASSPATH=target\classes;lib\* | ||
|
||
echo Running with classpath "%CLASSPATH%" | ||
echo Starting... | ||
"%JAVA_HOME%\bin\java.exe" -classpath "%CLASSPATH%" %MAIN_CLASS% %* | ||
|
||
goto :end | ||
|
||
:error | ||
echo ERROR: JAVA_HOME not found in your environment. | ||
echo Please, set the JAVA_HOME variable in your environment to match the | ||
echo location of the Java Virtual Machine you want to use. | ||
|
||
:end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/sh | ||
|
||
echo | ||
echo "Swing Example" | ||
echo "-------------------" | ||
echo | ||
|
||
if [ "$JAVA_HOME" = "" ] ; then | ||
echo "ERROR: JAVA_HOME not found in your environment." | ||
echo | ||
echo "Please, set the JAVA_HOME variable in your environment to match the" | ||
echo "location of the Java Virtual Machine you want to use." | ||
exit 1 | ||
fi | ||
|
||
if [ `uname | grep -n CYGWIN` ]; then | ||
PS=";" | ||
elif [ `uname | grep -n Windows` ]; then | ||
PS=";" | ||
else | ||
PS=":" | ||
fi | ||
|
||
LOCALCLASSPATH=target/classes${PS}lib/* | ||
|
||
echo Running with classpath $LOCALCLASSPATH | ||
echo Starting... | ||
echo | ||
|
||
"$JAVA_HOME/bin/java" -classpath "$LOCALCLASSPATH" example.MainPanel $* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
package example; | ||
//-*- mode:java; encoding:utf-8 -*- | ||
// vim:set fileencoding=utf-8: | ||
//@homepage@ | ||
import java.awt.*; | ||
import java.awt.event.*; | ||
import javax.swing.*; | ||
import com.sun.java.swing.plaf.windows.WindowsSliderUI; | ||
|
||
public final class MainPanel extends JPanel { | ||
private MainPanel() { | ||
super(new BorderLayout()); | ||
// UIManager.put("Slider.border", BorderFactory.createLineBorder(Color.GREEN)); | ||
// UIManager.put("Slider.focus", UIManager.get("Slider.background")); | ||
// UIManager.put("Slider.focusInsets", new Insets(5, 15, 5, 15)); | ||
|
||
JSlider slider1 = new JSlider(0, 100, 0); | ||
initSlider(slider1); | ||
// TEST: slider1.setBorder(BorderFactory.createLineBorder(Color.RED)); | ||
|
||
JSlider slider2 = new JSlider(0, 100, 0) { | ||
private transient FocusListener listener; | ||
@Override public void updateUI() { | ||
removeFocusListener(listener); | ||
super.updateUI(); | ||
if (getUI() instanceof WindowsSliderUI) { | ||
setUI(new WindowsSliderUI(this) { | ||
@Override public void paintFocus(Graphics g) { | ||
// // TEST: | ||
// Graphics2D g2 = (Graphics2D) g.create(); | ||
// g2.setPaint(new Color(255, 255, 255, 100)); | ||
// g2.fill(focusRect); | ||
// g2.dispose(); | ||
} | ||
// @Override protected Color getHighlightColor() { | ||
// Color c = super.getHighlightColor(); | ||
// return slider.hasFocus() ? Color.GREEN : Color.RED; | ||
// } | ||
}); | ||
Color bgc = getBackground(); | ||
listener = new FocusListener() { | ||
@Override public void focusGained(FocusEvent e) { | ||
setBackground(bgc.brighter()); | ||
} | ||
@Override public void focusLost(FocusEvent e) { | ||
setBackground(bgc); | ||
} | ||
}; | ||
addFocusListener(listener); | ||
} | ||
} | ||
}; | ||
initSlider(slider2); | ||
|
||
Box box = Box.createVerticalBox(); | ||
box.add(Box.createVerticalStrut(20)); | ||
box.add(makeTitledPanel("Default", slider1)); | ||
box.add(Box.createVerticalStrut(20)); | ||
box.add(makeTitledPanel("Override SilderUI#paintFocus(...)", slider2)); | ||
box.add(Box.createVerticalGlue()); | ||
|
||
add(box, BorderLayout.NORTH); | ||
setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); | ||
setPreferredSize(new Dimension(320, 240)); | ||
} | ||
private static JSlider initSlider(JSlider slider) { | ||
slider.setMajorTickSpacing(10); | ||
slider.setMinorTickSpacing(5); | ||
slider.setPaintTicks(true); | ||
return slider; | ||
} | ||
private static Component makeTitledPanel(String title, Component c) { | ||
JPanel p = new JPanel(new BorderLayout()); | ||
p.setBorder(BorderFactory.createTitledBorder(title)); | ||
p.add(c); | ||
return p; | ||
} | ||
public static void main(String... args) { | ||
EventQueue.invokeLater(new Runnable() { | ||
@Override public void run() { | ||
createAndShowGUI(); | ||
} | ||
}); | ||
} | ||
public static void createAndShowGUI() { | ||
try { | ||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); | ||
} catch (ClassNotFoundException | InstantiationException | ||
| IllegalAccessException | UnsupportedLookAndFeelException ex) { | ||
ex.printStackTrace(); | ||
} | ||
JFrame frame = new JFrame("@title@"); | ||
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); | ||
frame.getContentPane().add(new MainPanel()); | ||
frame.pack(); | ||
frame.setLocationRelativeTo(null); | ||
frame.setVisible(true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<jnlp spec="1.0+" codebase="@codebase@" href="example.jnlp"> | ||
<information> | ||
<title>@title@</title> | ||
<vendor>@vendor@</vendor> | ||
<homepage href="@homepage@" /> | ||
<description>Swing Example</description> | ||
<description kind="short">example</description> | ||
</information> | ||
<update check="timeout" policy="always" /> | ||
<resources> | ||
<java version="@compile.source@+" /> | ||
<jar href="example.jar" main="true" /> | ||
</resources> | ||
<application-desc main-class="@main.class@" /> | ||
</jnlp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<html lang="ja"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>@title@</title> | ||
<link rel="canonical" href="@homepage@" /> | ||
<script type="text/javascript"> | ||
location.replace('@homepage@'); | ||
</script> | ||
<meta http-equiv="Refresh" content="0; URL=@homepage@" /> | ||
</head> | ||
<body> | ||
<noscript> | ||
<p><a href="@homepage@">@title@</a></p> | ||
</noscript> | ||
</body> | ||
</html> |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.