Skip to content

Commit

Permalink
Show fonts in the font pulldown as WYSIWYG
Browse files Browse the repository at this point in the history
  • Loading branch information
kkieffer committed May 25, 2018
1 parent ddd9a62 commit d2cfa7d
Show file tree
Hide file tree
Showing 9 changed files with 1,709 additions and 248 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Modifications
* Added button to Image Attributes dialog to allow browsing for image files on disk
* Updated hotkeys for menu items for specific OS (i.e. CTRL for Win, CMD for Mac)
* Added icons and other cosmetic changes

* Font combo box now displays WYSIWYG fonts


License
Expand Down
34 changes: 19 additions & 15 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,25 @@
<tstamp> <format property="timestamp" pattern="yyyy-MM-dd" /> </tstamp>


<target name="-post-jar" description="Zip the source and binaries">
<mkdir dir="${dist.dir}"/>

<zip zipfile="${dist.dir}/SHEF-src-${timestamp}.zip">
<fileset dir="." excludes="build/**, dist/**"/>
</zip>

<zip zipfile="${dist.dir}/SHEF-bin-${timestamp}.zip">
<fileset dir="." excludes="src/**, lib/**, build/**, dist/**.zip"/>
</zip>


</target>



<target name="-post-jar">
<property name="store.jar.name" value="ShefComplete"/>
<property name="store.dir" value="dist"/>
<property name="store.jar" value="${store.dir}/${store.jar.name}.jar"/>
<echo message="Packaging ${application.title} into a single JAR at ${store.jar}"/>
<jar destfile="${store.dir}/temp_final.jar" filesetmanifest="skip">
<zipgroupfileset dir="dist" includes="*.jar"/>
<zipgroupfileset dir="dist/lib" includes="*.jar"/>
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
</manifest>
</jar>
<zip destfile="${store.jar}">
<zipfileset src="${store.dir}/temp_final.jar"
excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA"/>
</zip>
<delete file="${store.dir}/temp_final.jar"/>
</target>

<!--
Expand Down
Binary file not shown.
10 changes: 8 additions & 2 deletions lib/nblibraries.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
libs.CopyLibs.classpath=\
${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
libs.CopyLibs.displayName=CopyLibs Task
libs.CopyLibs.prop-version=2.0
libs.hamcrest.classpath=\
${base}/hamcrest/hamcrest-core-1.3.jar
libs.hamcrest.displayName=Hamcrest 1.3
libs.hamcrest.prop-maven-dependencies=org.hamcrest:hamcrest-core:1.3:jar
libs.junit.classpath=\
${base}/junit/junit-3.8.2.jar
libs.junit.javadoc=\
Expand All @@ -8,7 +16,5 @@ libs.junit_4.javadoc=\
${base}/junit_4/junit-4.5-api.zip
libs.junit_4.src=\
${base}/junit_4/junit-4.5-src.jar
libs.CopyLibs.classpath=\
${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
libs.JWSAntTasks.classpath=\
${base}/JWSAntTasks/org-netbeans-modules-javawebstart-anttasks.jar
1,019 changes: 901 additions & 118 deletions nbproject/build-impl.xml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions nbproject/genfiles.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ build.xml.stylesheet.CRC32=958a1d3e
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=5d605312
nbproject/build-impl.xml.script.CRC32=14bfdec4
nbproject/build-impl.xml.stylesheet.CRC32=65b8de21
nbproject/build-impl.xml.script.CRC32=e414e0b9
nbproject/build-impl.xml.stylesheet.CRC32=[email protected]
721 changes: 686 additions & 35 deletions nbproject/jnlp-impl.xml

Large diffs are not rendered by default.

133 changes: 68 additions & 65 deletions nbproject/project.properties
Original file line number Diff line number Diff line change
@@ -1,79 +1,82 @@
ant.customtasks.libs=JWSAntTasks
application.desc=Swing HTML Editor Framework
application.homepage=http://shef.sourceforge.net
application.title=SHEF
application.vendor=Bob Tantlinger
build.classes.dir=${build.dir}/classes
#Thu Mar 29 11:46:43 EDT 2018
jnlp.offline-allowed=true
javadoc.splitindex=true
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
# Only compile against the classpath explicitly listed here:
jnlp.codebase.url=$$$$codebase
javadoc.author=true
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/SHEF.jar
dist.javadoc.dir=${dist.dir}/javadoc
excludes=
file.reference.jtidy-8.0.jar=lib/jtidy-8.0.jar
javac.target=1.5
build.generated.dir=${build.dir}/generated
run.classpath=${javac.classpath}\:${build.classes.dir}
debug.test.classpath=${run.test.classpath}
jnlp.descriptor=application
build.dir=build
javac.deprecation=false
jnlp.signed=true
file.reference.novaworx-syntax-0.0.7.jar=lib/novaworx-syntax-0.0.7.jar
file.reference.sam.jar=lib/sam.jar
test.src.dir=test
junit.selected.version=3
jar.archive.disabled=${jnlp.enabled}
application.homepage=http\://shef.sourceforge.net
includes=**
application.vendor=Bob Tantlinger
file.reference.jtidy-8.0.jar=lib/jtidy-8.0.jar
mkdist.disabled=false
jar.compress=false
javac.classpath=\
${file.reference.jtidy-8.0.jar}:\
${file.reference.novaworx-syntax-0.0.7.jar}:\
${file.reference.sam.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
jnlp.mixed.code=default
ant.customtasks.libs=JWSAntTasks
annotation.processing.processors.list=
javac.external.vm=false
javadoc.version=false
build.classes.dir=${build.dir}/classes
dist.dir=dist
manifest.file=manifest.mf
javac.source=1.5
javac.target=1.5
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}:\
${libs.junit.classpath}:\
${libs.junit_4.classpath}
run.jvmargs=
manifest.custom.permissions=
run.test.classpath=${javac.test.classpath}\:${build.test.classes.dir}
build.generated.sources.dir=${build.dir}/generated-sources
jnlp.signing=generated
javadoc.notree=false
dist.jar=${dist.dir}/SHEF.jar
manifest.custom.caller.allowable.codebase=
platform.active=default_platform
manifest.custom.application.library.allowable.codebase=
annotation.processing.enabled=true
main.class=net.atlanticbb.tantlinger.shef.Demo
dist.javadoc.dir=${dist.dir}/javadoc
javadoc.additionalparam=
javadoc.author=true
javadoc.encoding=${source.encoding}
javac.classpath=${file.reference.jtidy-8.0.jar}\:${file.reference.novaworx-syntax-0.0.7.jar}\:${file.reference.sam.jar}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
manifest.custom.codebase=
annotation.processing.enabled.in.editor=false
javadoc.private=false
javadoc.splitindex=true
javadoc.encoding=${source.encoding}
build.test.classes.dir=${build.dir}/test/classes
jar.index=${jnlp.enabled}
javac.compilerargs=
jnlp.codebase.user=http\://shef.sourceforge.net
source.encoding=UTF-8
application.desc=Swing HTML Editor Framework
jnlp.signing.keystore=
meta.inf.dir=${src.dir}/META-INF
annotation.processing.run.all.processors=true
excludes=
application.title=SHEF
jnlp.codebase.type=user
javac.processorpath=${javac.classpath}
build.test.results.dir=${build.dir}/test/results
endorsed.classpath=
javadoc.use=true
javadoc.version=false
javadoc.nonavbar=false
jnlp.signing.alias=SHEF
javadoc.windowtitle=
jnlp.codebase.type=user
jnlp.codebase.url=$$$$codebase
jnlp.codebase.user=http://shef.sourceforge.net
jnlp.descriptor=application
jnlp.enabled=true
jnlp.offline-allowed=true
jnlp.signed=true
main.class=net.atlanticbb.tantlinger.shef.Demo
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
platform.active=default_platform
run.classpath=\
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
# or test-sys-prop.name=value to set system properties for unit tests):
run.jvmargs=
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
${build.classes.dir}:\
${libs.junit_4.classpath}:\
${libs.hamcrest.classpath}
src.dir=src
test.src.dir=test
debug.classpath=${run.classpath}
jnlp.enabled=false
34 changes: 24 additions & 10 deletions src/net/atlanticbb/tantlinger/shef/HTMLEditorPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;

import javax.swing.AbstractButton;
import javax.swing.Action;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JEditorPane;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JMenu;
import javax.swing.JPanel;
Expand Down Expand Up @@ -336,21 +336,35 @@ public void propertyChange(PropertyChangeEvent evt)
formatToolBar.add(paragraphCombo);
formatToolBar.addSeparator();

Vector fonts = new Vector();
ArrayList<String> fonts = new ArrayList<String>();
fonts.add("Default");
fonts.add("serif");
fonts.add("sans-serif");
fonts.add("monospaced");
GraphicsEnvironment gEnv =
GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsEnvironment gEnv = GraphicsEnvironment.getLocalGraphicsEnvironment();
fonts.addAll(Arrays.asList(gEnv.getAvailableFontFamilyNames()));

fontFamilyCombo = new JComboBox(fonts);
fontFamilyCombo.setPreferredSize(new Dimension(150, 22));
fontFamilyCombo.setMinimumSize(new Dimension(150, 22));
fontFamilyCombo.setMaximumSize(new Dimension(150, 22));
fontFamilyCombo.setFont(comboFont);
fontFamilyCombo.addActionListener(fontChangeHandler);
fontFamilyCombo = new JComboBox<Font>();

for (String f : fonts)
fontFamilyCombo.addItem(new Font(f, Font.PLAIN, 12));

fontFamilyCombo.setRenderer(new DefaultListCellRenderer() {

protected DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer();

@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel renderer = (JLabel) defaultRenderer.getListCellRendererComponent(list, value, index, isSelected,cellHasFocus);
renderer.setFont((Font)value);
renderer.setText(((Font)value).getFontName());
fontFamilyCombo.setFont((Font)value);
return renderer;
}
});



formatToolBar.add(fontFamilyCombo);

final JButton fontSizeButton = new JButton(UIUtils.getIcon(UIUtils.X16, "fontsize.png"));
Expand Down

0 comments on commit d2cfa7d

Please sign in to comment.