Trivial code cleanup
This commit is contained in:
parent
80c6bd812b
commit
558366e3da
1 changed files with 9 additions and 8 deletions
|
@ -3,6 +3,7 @@ package net.vhati.modmanager.ui;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Cursor;
|
import java.awt.Cursor;
|
||||||
import java.awt.Desktop;
|
import java.awt.Desktop;
|
||||||
|
import java.awt.Font;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
|
@ -124,11 +125,11 @@ public class ModInfoArea extends JScrollPane {
|
||||||
|
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
if ( author != null ) {
|
if ( author != null ) {
|
||||||
doc.insertString( doc.getLength(), String.format("%sby %s", (first ? "" : " "), author), regularStyle );
|
doc.insertString( doc.getLength(), String.format( "%sby %s", (first ? "" : " "), author ), regularStyle );
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
if ( version != null ) {
|
if ( version != null ) {
|
||||||
doc.insertString( doc.getLength(), String.format("%s(version %s)", (first ? "" : " "), version), regularStyle );
|
doc.insertString( doc.getLength(), String.format( "%s(version %s)", (first ? "" : " "), version ), regularStyle );
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
if ( !first ) {
|
if ( !first ) {
|
||||||
|
@ -156,7 +157,7 @@ public class ModInfoArea extends JScrollPane {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch ( BadLocationException e ) {
|
catch ( BadLocationException e ) {
|
||||||
log.error( "Error filling info text area.", e );
|
log.error( "Error filling info text area", e );
|
||||||
}
|
}
|
||||||
|
|
||||||
textPane.setCaretPosition( 0 );
|
textPane.setCaretPosition( 0 );
|
||||||
|
@ -171,8 +172,8 @@ public class ModInfoArea extends JScrollPane {
|
||||||
try {
|
try {
|
||||||
doc.remove( 0, doc.getLength() );
|
doc.remove( 0, doc.getLength() );
|
||||||
}
|
}
|
||||||
catch ( BadLocationException e) {
|
catch ( BadLocationException e ) {
|
||||||
log.error( "Error clearing info text area.", e );
|
log.error( "Error clearing info text area", e );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,10 +207,10 @@ public class ModInfoArea extends JScrollPane {
|
||||||
private static StyleContext getDefaultStyleContext() {
|
private static StyleContext getDefaultStyleContext() {
|
||||||
StyleContext result = new StyleContext();
|
StyleContext result = new StyleContext();
|
||||||
Style defaultStyle = StyleContext.getDefaultStyleContext().getStyle( StyleContext.DEFAULT_STYLE );
|
Style defaultStyle = StyleContext.getDefaultStyleContext().getStyle( StyleContext.DEFAULT_STYLE );
|
||||||
Style baseStyle = result.addStyle("base", defaultStyle);
|
Style baseStyle = result.addStyle( "base", defaultStyle );
|
||||||
|
|
||||||
Style regularStyle = result.addStyle( STYLE_REGULAR, baseStyle );
|
Style regularStyle = result.addStyle( STYLE_REGULAR, baseStyle );
|
||||||
StyleConstants.setFontFamily( regularStyle, "Monospaced" );
|
StyleConstants.setFontFamily( regularStyle, Font.MONOSPACED );
|
||||||
StyleConstants.setFontSize( regularStyle, 12 );
|
StyleConstants.setFontSize( regularStyle, 12 );
|
||||||
|
|
||||||
Style hyperStyle = result.addStyle( STYLE_HYPERLINK, regularStyle );
|
Style hyperStyle = result.addStyle( STYLE_HYPERLINK, regularStyle );
|
||||||
|
@ -217,7 +218,7 @@ public class ModInfoArea extends JScrollPane {
|
||||||
StyleConstants.setUnderline( hyperStyle, true );
|
StyleConstants.setUnderline( hyperStyle, true );
|
||||||
|
|
||||||
Style titleStyle = result.addStyle( STYLE_TITLE, baseStyle );
|
Style titleStyle = result.addStyle( STYLE_TITLE, baseStyle );
|
||||||
StyleConstants.setFontFamily( titleStyle, "SansSerif" );
|
StyleConstants.setFontFamily( titleStyle, Font.SANS_SERIF );
|
||||||
StyleConstants.setFontSize( titleStyle, 24 );
|
StyleConstants.setFontSize( titleStyle, 24 );
|
||||||
StyleConstants.setBold( titleStyle, true );
|
StyleConstants.setBold( titleStyle, true );
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue