Commit e0283951 authored by Claes Sjofors's avatar Claes Sjofors

java JopWindow font and encoding fix

parent 44b8f6d9
......@@ -37,6 +37,9 @@
package jpwr.jop;
import java.awt.*;
import java.awt.font.*;
/**
Jop basic definitions.
*/
......@@ -45,7 +48,9 @@ public class Jop {
public static final int BUTTON_ACTION_RESET = 1;
public static final int BUTTON_ACTION_TOGGLE = 2;
public static final int BUTTON_ACTION_COMMAND = 3;
public static Font defFont14 = new Font("Lucida Sans", Font.PLAIN, 14);
public static Font defFont16 = new Font("Lucida Sans", Font.PLAIN, 16);
public static Font defFont20 = new Font("Lucida Sans", Font.PLAIN, 20);
public static int executeCommand( JopSession session, String command) {
return JopSpider.command( session, command);
}
......
......@@ -375,7 +375,7 @@ public class JopLang {
if ( i == 1 && lang == LANGUAGE_zh_CN)
r2 = new InputStreamReader(in, "UTF-8");
else
r2 = new InputStreamReader(in);
r2 = new InputStreamReader(in, "ISO-8859-1");
reader = new BufferedReader( r2);
}
catch ( Exception e) {
......@@ -395,7 +395,7 @@ public class JopLang {
reader = new BufferedReader( new InputStreamReader( new FileInputStream( filename), "UTF-8"));
}
else
reader = new BufferedReader( new InputStreamReader( new FileInputStream( filename)));
reader = new BufferedReader( new InputStreamReader( new FileInputStream( filename), "ISO-8859-1"));
}
catch ( Exception e) {
System.out.println( "Unable to open file " + filename);
......
......@@ -37,6 +37,38 @@ public class JopOp {
frame.setBounds( 0, 0, frameSize.width, screenSize.height);
// frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
frame.setVisible(true);
UIManager.put("Button.font", Jop.defFont14);
UIManager.put("ToggleButton.font", Jop.defFont14);
UIManager.put("RadioButton.font", Jop.defFont14);
UIManager.put("CheckBox.font", Jop.defFont14);
UIManager.put("ColorChooser.font", Jop.defFont14);
UIManager.put("ComboBox.font", Jop.defFont14);
UIManager.put("Label.font", Jop.defFont14);
UIManager.put("List.font", Jop.defFont14);
UIManager.put("MenuBar.font", Jop.defFont14);
UIManager.put("MenuItem.font", Jop.defFont14);
UIManager.put("RadioButtonMenuItem.font", Jop.defFont14);
UIManager.put("CheckBoxMenuItem.font", Jop.defFont14);
UIManager.put("Menu.font", Jop.defFont14);
UIManager.put("PopupMenu.font", Jop.defFont14);
UIManager.put("OptionPane.font", Jop.defFont14);
UIManager.put("Panel.font", Jop.defFont14);
UIManager.put("ProgressBar.font", Jop.defFont14);
UIManager.put("ScrollPane.font", Jop.defFont14);
UIManager.put("Viewport.font", Jop.defFont14);
UIManager.put("TabbedPane.font", Jop.defFont14);
UIManager.put("Table.font", Jop.defFont14);
UIManager.put("TableHeader.font", Jop.defFont14);
UIManager.put("TextField.font", Jop.defFont14);
UIManager.put("PasswordField.font", Jop.defFont14);
UIManager.put("TextArea.font", Jop.defFont14);
UIManager.put("TextPane.font", Jop.defFont14);
UIManager.put("EditorPane.font", Jop.defFont14);
UIManager.put("TitledBorder.font", Jop.defFont14);
UIManager.put("ToolBar.font", Jop.defFont14);
UIManager.put("ToolTip.font", Jop.defFont14);
UIManager.put("Tree.font", Jop.defFont14);
}
//Main method
......
......@@ -93,8 +93,7 @@ public class JopOpWindow extends JPanel {
if ( srettxt.evenSts()) return;
JLabel llabel = new JLabel( srettxt.str);
Font f = new Font("Helvetica", Font.BOLD, 24);
llabel.setFont( f);
llabel.setFont( Jop.defFont20);
this.add( llabel);
s = sret.str + ".Text";
......@@ -102,8 +101,7 @@ public class JopOpWindow extends JPanel {
if ( srettxt.evenSts()) return;
llabel = new JLabel( srettxt.str);
f = new Font("Helvetica", Font.BOLD, 16);
llabel.setFont( f);
llabel.setFont( Jop.defFont16);
this.add( llabel);
this.add( new JSeparator());
......@@ -313,6 +311,8 @@ public class JopOpWindow extends JPanel {
this.session = bsession;
this.action = name;
this.type = btype;
setFont( Jop.defFont14);
setText( text);
setHorizontalTextPosition( SwingConstants.LEFT);
this.addMouseListener(new MouseAdapter() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment