Permalink
Browse files

larger font, improved webstart

  • Loading branch information...
Kristofer Karlsson
Kristofer Karlsson committed May 4, 2010
1 parent 93b4f07 commit ced34ee8549c9e7f9db37c593016ca2504da15d5
Binary file not shown.
@@ -20,13 +20,7 @@
# THE SOFTWARE.
#
-#
-# Kahlua Properties:
-#
-Components = jsyntaxpane.components.PairsMarker, \
- jsyntaxpane.components.TokenMarker
-
-# jsyntaxpane.components.LineNumbersRuler, \
+Components = jsyntaxpane.components.TokenMarker
SingleColorSelect = true
@@ -43,3 +37,5 @@ Style.NUMBER = 0x11cc33, 0
Style.IDENTIFIER = 0xccccff, 0
Style.COMMENT = 0x999999, 2
Style.DEFAULT = 0xffffff, 2
+
+DefaultFont = Monospaced 14
@@ -48,7 +48,6 @@ of this software and associated documentation files (the "Software"), to deal
private final KahluaThread thread;
private final OutputTerminal output;
private final JLabel outputTitle = new JLabel("Output:");
- private final JLabel inputTitle = new JLabel("Input:");
private final History history = new History();
private final ExecutorService executors = Executors.newSingleThreadExecutor(new DaemonizedThreadFactory(Executors.defaultThreadFactory()));
@@ -68,7 +67,7 @@ public Interpreter(Platform platform, KahluaTable env, JFrame owner) {
final Terminal input = new Terminal(true, Color.BLACK, Color.WHITE);
- JSyntaxUtil.installSyntax(input.getTextPane());
+ JSyntaxUtil.installSyntax(input.getTextPane(), true);
new AutoComplete(owner, input.getTextPane(), platform, env);
@@ -101,7 +100,6 @@ public void keyReleased(KeyEvent e) {
input.setPreferredSize(new Dimension(800, 100));
JPanel inputPanel = new JPanel(new BorderLayout());
- inputPanel.add(inputTitle, BorderLayout.NORTH);
inputPanel.add(input, BorderLayout.CENTER);
this.add(inputPanel, BorderLayout.SOUTH);
@@ -172,7 +172,7 @@ private void createLuaPane() {
JEditorPane pane = new JEditorPane();
pane.setBackground(background);
- JSyntaxUtil.installSyntax(pane);
+ JSyntaxUtil.installSyntax(pane, false);
view.add(pane);
current = pane;
@@ -25,10 +25,14 @@ of this software and associated documentation files (the "Software"), to deal
import jsyntaxpane.DefaultSyntaxKit;
import jsyntaxpane.SyntaxStyle;
import jsyntaxpane.SyntaxStyles;
+import jsyntaxpane.components.PairsMarker;
+import jsyntaxpane.components.TokenMarker;
import jsyntaxpane.util.Configuration;
import javax.swing.*;
import java.awt.*;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
import java.lang.reflect.Field;
import java.util.Properties;
@@ -49,12 +53,30 @@ public static void setup() {
DefaultSyntaxKit.initKit();
}
- public static KahluaKit installSyntax(final JEditorPane textPane) {
- KahluaKit kahluaKit = new KahluaKit();
+ public static KahluaKit installSyntax(final JEditorPane textPane, boolean highlight) {
+ final KahluaKit kahluaKit = new KahluaKit();
Properties config = new Properties();
config.put("CaretColor", "0xffffff");
kahluaKit.setConfig(config);
textPane.setEditorKit(kahluaKit);
+
+ kahluaKit.deinstallComponent(textPane, TokenMarker.class.getName());
+
+ if (highlight) {
+ textPane.addFocusListener(new FocusListener() {
+ @Override
+ public void focusGained(FocusEvent e) {
+ kahluaKit.installComponent(textPane, PairsMarker.class.getName());
+ kahluaKit.installComponent(textPane, TokenMarker.class.getName());
+ }
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ kahluaKit.deinstallComponent(textPane, PairsMarker.class.getName());
+ kahluaKit.deinstallComponent(textPane, TokenMarker.class.getName());
+ }
+ });
+ }
return kahluaKit;
}
}
View
@@ -6,8 +6,9 @@
<property name="deploy.dir" location="${baseDir}/webstart"/>
- <property name="webstart.build.dir" value="${baseDir}/bin/webstart/build"/>
- <property name="webstart.jar.name" value="kahlua2demo.jar"/>
+ <property name="webstart.build.dir" value="${baseDir}/bin/webstart"/>
+ <property name="webstart.jar.name" value="${name}.jar"/>
+ <property name="webstart.signed.dir" value="${webstart.build.dir}/${name}"/>
<property name="libs.dir" value="${webstart.build.dir}"/>
@@ -23,8 +24,10 @@
</genkey>
</target>
- <property name="webstart.signed.dir" value="${baseDir}/bin/webstart/signed"/>
- <target name="build-webstart">
+ <target name="build-webstart">
+ <fail unless="name" message="usage: ant -f webstart.xml build-webstart -Dname=kahlua2-v1"/>
+
+ <delete dir="${webstart.build.dir}" />
<mkdir dir="${webstart.build.dir}"/>
<manifestclasspath taskname="setup-manifest" property="dist.manifest.classpath" jarfile="${webstart.build.dir}/${webstart.jar.name}">
@@ -46,6 +49,11 @@
</path>
<flattenmapper/>
</signjar>
- <copy todir="${webstart.signed.dir}" file="${deploy.dir}/kahlua2.jnlp" />
+ <copy tofile="${webstart.signed.dir}/${name}.jnlp" file="${deploy.dir}/kahlua2.jnlp" />
+ <replace
+ file="${webstart.signed.dir}/${name}.jnlp"
+ token="@NAME@"
+ value="${name}"
+ />
</target>
</project>
View
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+"
codebase="http://github.com/downloads/krka/kahlua2/"
- href="kahlua2.jnlp">
+ href="@NAME@.jnlp">
<information>
- <title>Kahlua</title>
+ <title>Kahlua 2</title>
<vendor>Kahlua</vendor>
<homepage href="http://code.google.com/p/kahlua"/>
<description kind="short">Kahlua is a Lua implementation in Java</description>
@@ -15,7 +15,7 @@
<all-permissions/>
</security>
<resources>
- <jar href="kahlua2demo.jar"/>
+ <jar href="@NAME@.jar"/>
</resources>
<application-desc main-class="se.krka.kahlua.j2se.interpreter.InteractiveShell"/>

0 comments on commit ced34ee

Please sign in to comment.