Id : | 265 |
Type : | IMPROVEMENT |
Reporter : | Nishio Hirokazu |
Assignee : | |
Priority : | MINOR |
Creation Date : | 27 Sep 07 10:21 |
Last Update Date : | 27 Sep 07 10:49 |
Resolution : | UNRESOLVED |
Index: JyConsole.java =================================================================== --- JyConsole.java (revision 1) +++ JyConsole.java (working copy) @@ -49,6 +49,7 @@ import java.awt.Color; import java.awt.Component; import java.awt.Event; +import java.awt.Font; import java.awt.Point; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; @@ -203,6 +204,25 @@ // add ui in panel scroll = new JScrollPane(uiContent); add(scroll, BorderLayout.CENTER); + + + + Font font = Utils.font; + cmdUI.setFont(font); + cmdLineUI.setFont(font); + archiveUI.setFont(font); + Utils.setTabWidth(archiveUI); + + StyleConstants.setFontSize( + cmdUI.getStyle(STYLE_NORMAL), Utils.FONT_SIZE); + StyleConstants.setFontSize( + cmdModel.getStyle(STYLE_NORMAL), Utils.FONT_SIZE); + StyleConstants.setFontSize( + archiveUI.getStyle(STYLE_NORMAL), Utils.FONT_SIZE); + StyleConstants.setFontSize( + archiveModel.getStyle(STYLE_NORMAL), Utils.FONT_SIZE); + + // Init pref preference = new Hashtable(); if (System.getProperty(PREF_SCRIPT_DIR) != null) { @@ -544,6 +564,11 @@ setColorToStyle(STYLE_NORMAL, fg); }+ public void setFontSizeToStyle(String styleName, int fontsize) { + StyleConstants.setFontSize(archiveModel.getStyle(styleName), fontsize); + StyleConstants.setFontSize(cmdModel.getStyle(styleName), fontsize); + } + public void setColorToStyle(String styleName, Color fg) { StyleConstants.setForeground(archiveModel.getStyle(styleName), fg); StyleConstants.setForeground(cmdModel.getStyle(styleName), fg); Index: ui/Prompt.java =================================================================== --- ui/Prompt.java (revision 1) +++ ui/Prompt.java (working copy) @@ -23,6 +23,7 @@ package com.artenum.jyconsole.ui; import java.awt.Color; +import java.awt.Font; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener;@@ -37,21 +38,26 @@ import javax.swing.JPanel; import javax.swing.JTextPane;+import com.artenum.jyconsole.Utils; + /** * @author Sebastien Jourdain, jourdain@artenum.com */ public class Prompt extends JPanel implements ComponentListener { - private final static String l1 = ">>> "; + private final static String l1 = ">>> "; private final static String ln = "<br>… "; private JTextPane txtCmd; - private JLabel label; + private JLabel label = new JLabel(); public Prompt(JTextPane txtCmd) { setOpaque(true); - label = new JLabel(); label.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); showNLines(1); this.txtCmd = txtCmd; + label.setFont(Utils.font); + txtCmd.setFont(Utils.font); + Utils.setTabWidth(txtCmd); + txtCmd.addComponentListener(this); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); add(label); Index: Utils.java =================================================================== --- Utils.java (revision 0) +++ Utils.java (revision 0) @@ -0,0 +1,36 @@ +package com.artenum.jyconsole; + +import java.awt.Font; +import java.awt.FontMetrics; + +import javax.swing.JTextPane; +import javax.swing.text.SimpleAttributeSet; +import javax.swing.text.StyleConstants; +import javax.swing.text.TabSet; +import javax.swing.text.TabStop; + +/** + * ad-hoc utility class to modify JyConsole's + * font size and tab width + * @author NISHIO Hirokazu + * + */ +public class Utils { + public static final int FONT_SIZE = 40; + public static final Font font = new Font("Monospaced", 0 , FONT_SIZE); + + public static void setTabWidth(JTextPane textpane) { + FontMetrics fm = textpane.getFontMetrics(textpane.getFont()); + int charWidth = fm.charWidth('m'); + int tabLength = charWidth * 4; + TabStop"resourceLink" href="/projects/jyconsole/wishList/Font_size_tab_size_etc">Font size, tab size, etc tabs = new TabStop"resourceLink" href="/projects/jyconsole/wishList/Font_size_tab_size_etc/10">"error">! 10 !; + for(int j=0;j<tabs.length;j++) { + tabs"resourceLink" href="/projects/jyconsole/wishList/Font_size_tab_size_etc/j">"error">! j ! = new TabStop((j+1)*tabLength); + } + TabSet tabSet = new TabSet(tabs); + SimpleAttributeSet attrs = new SimpleAttributeSet(); + StyleConstants.setTabSet(attrs, tabSet); + int l = textpane.getDocument().getLength(); + textpane.getStyledDocument().setParagraphAttributes(0, l, attrs, false); + } +}
nishio.patch | 4 ko. | Sep 27, 2007 10:22 AM | Go to file |
Mnemonic | Rendering | Comment |
---|---|---|
1 Title | a style 1 heading (major heading) | |
1.1 Title | a style 1.1 heading (minor heading) | |
- text | a list item (with -), several lines create a single list | |
* text | a list item (with *) | |
1. text | an enumerated list | |
__bold__ | bold | simple bold text |
~~italics~~ | italics | simple italic text |
--strike-- | strike through text | |
(empty line) | produces a new paragraph | |
\\ | creates a line break, please use sparingly! | |
[/documentation] or [../documentation] or [/documentation|Doc] | Like a standard link | internal link to another document |
http://www.libresource.org/ | http://www.libresource.org/ | creates a link to an external resource, special characters that come after the URL and are not part of it must be separated with a space. |
\X | X | escape special character X (i.e. {) |
---- | creates a horizontal rule |
Macro | Description | Parameters |
---|---|---|
api | Generates links to Java or Ruby API documentation. | 1: class name, e.g. java.lang.Object or java.lang.Object@Java131 2: mode, e.g. Java12, Ruby, defaults to Java (optional) |
asin | Generates links to DVD/CD dealers or comparison services. Configuration is read from conf/asinservices.txt | 1: asin number |
blink | Blink a text. | the text |
bookmarks | Display the user bookmarks. | none |
box | Create a box in order to change the basic disposition. | 1. the box title (optional) 2. the floating behaviour (left or right) (optional) 3. the height of the box (px,%) (optional) 4. the width of the box (px,%) (optional) |
children | Display the current children list. | 1. uri= ...(optional) where you list the resources, the default uri is the current 2. groupby=… (optional) to group resources.The following value are available : type or owner or uri or creation or update or name 3. sort=… (optional) to sort resources. The values available are : type or owner or uri or creation or update or name 4. creation=...(optional) allows you to filter on the creation date. The values available are: Date (dd/MM/yyyy) or '+'/'-'/'!' followed by a Date(dd/MM/yyyy): allows to keep superior/inferior/exclude date 5. update=...(optional) allows you to filter on the modification date. The values available are: Date (dd/MM/yyyy) or '+'/'-'/'!' followed by a Date(dd/MM/yyyy): allows to keep superior/inferior/exclude date 6. type=...(optional) :allows you to filter resources with its type. The values available are : Project, Template, Timeline, Page, Repository, File, Forum, Thread, Message, Group, Synchronizer, BugTracker, Issue, Site, Survey, Form, DropBox 7. owner=...(optional):allows you to show only resources belonging to one user or many users. 8. limit=...(optional): allows you to limit the displayed resources 9. depth=...(optional): allows you to fix the depth of listed ressources 10. view=...(optional): to fix the view of displayed resources. The view available are : flat (default view) or count(to display the number of listed ressources) or tree(display resource following tree viewer) |
code | Displays a chunk of code with syntax highlighting, for example Java, XML and SQL. The none type will do nothing and is useful for unknown code types. | 1: syntax highlighter to use, defaults to java (optional) |
hello | Say hello example macro. | 1: name to print |
html | By pass wiki engine to allow HTML code in content | the html block |
api-docs | Displays a list of known online API documentations and mappings. | none |
file-path | Displays a file system path. The file path should use slashes. Defaults to windows. | 1: file path |
image | Display an image. | 1. the image URI 2. align (right ,left or center) (optional) 3. width (optional) 4. height (optional) |
inter-wiki | Displays a list of known InterWiki mappings. | none |
isbn | Generates links to book dealers or comparison services. Configuration is read from conf/bookservices.txt. | 1: isbn number |
link | Generate a weblink. | unexplained, lazy programmer, probably |
list-of-macros | Displays a list of available macros. | unexplained, lazy programmer, probably |
loginBox | Display a login box. | none |
mailto | Displays an email address. | 1: mail address |
menu | Include the menu of the specified URI | 1. The uri for the menu to be include |
news | Display a message thread as news. | 1. the thread URI 2. Max (optional) |
pre | Allow rigid text style. (Keep text formating) | none |
printField | Display a node forms fields values. | 1. (uri=) The uri on which you want to get the form value (Optional, by default=.) 2. (print=) Print or not the field label and the field value (Optional, by default=label, value, edit) 3. (field=) Print or not the specified field (Optional, by default will print all) |
quote | Display quotations. | 1: source (optional) 2: displayed description, default is Source (optional) |
quoteMessage | Quote a message in another message by referencing only the message URI. | 1. The message URI to quote. |
resource | Include the view of a LibreSource resource. | 1. the uri of the resource (mandatory) 2. the view (optional) 3. the action (optional) 4. noaction (optional) |
rfc | Generates links to RFCs. | unexplained, lazy programmer, probably |
rss | Include an RSS feed. | 1. the url of the rss feed (mandatory) |
searchBox | Display a search box. | 1. the URI pattern |
subProjects | Display the current subProjects list. | none |
summary | Create the summary of a wiki page. | 1. the page URI (optional) |
survey | Display results of a survey. | the survey URI |
table | Displays a table. | none |
tableForm | Display a table listing form results. | 1. (uri=) The uri on which you want to get the form value (Optional, by default use the local path) 2. (print=) Print additinal features such as a link to the data (goLink) or a link to get a CSV file (csvExport) (Optional, by default print all) 3. (field=) The list of field to show (Optional by default all) |
timeline | Display the first items of a timeline. | 1. the timeline URI 2. Max items (optional) |
user | Generate a link to the current user page, according 'action'. | 1. the action (optional) 2. the link label (optional) |
workspaces | Display the user workspaces. | none |
xref | Generates links to Java Xref source code. | 1: class name, e.g. java.lang.Object or java.lang.Object@Nanning 2: line number (optional) |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() ![]() |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
:-) | :-( | ;-) | :-P | :-D | :-[ | :-/ | :-* | >:o | 8-) | :-$ | :-! | :'( | :-X =-O |