📄 textline.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: TextLine.java
package sTools.graph;
import java.awt.*;
import java.io.PrintStream;
import java.util.Stack;
import java.util.Vector;
// Referenced classes of package sTools.graph:
// TextState, SpecialFunction
public class TextLine
{
public static final int CENTER = 0;
public static final int LEFT = 1;
public static final int RIGHT = 2;
public static final int SCIENTIFIC = 1;
public static final int ALGEBRAIC = 2;
static final int MINIMUM_SIZE = 6;
protected double script_fraction;
protected double sup_offset;
protected double sub_offset;
protected Font font;
protected Color color;
protected Color background;
protected String text;
protected String fontname;
protected int fontsize;
protected int fontstyle;
protected int justification;
protected int width;
protected int ascent;
protected int maxAscent;
protected int descent;
protected int maxDescent;
protected int height;
protected int leading;
protected boolean parse;
protected Graphics lg;
protected Vector list;
public TextLine()
{
script_fraction = 0.80000000000000004D;
sup_offset = 0.59999999999999998D;
sub_offset = 0.69999999999999996D;
font = null;
color = null;
background = null;
text = null;
fontname = "TimesRoman";
fontsize = 0;
fontstyle = 0;
justification = 1;
width = 0;
ascent = 0;
maxAscent = 0;
descent = 0;
maxDescent = 0;
height = 0;
leading = 0;
parse = true;
lg = null;
list = new Vector(8, 4);
}
public TextLine(String s)
{
script_fraction = 0.80000000000000004D;
sup_offset = 0.59999999999999998D;
sub_offset = 0.69999999999999996D;
font = null;
color = null;
background = null;
text = null;
fontname = "TimesRoman";
fontsize = 0;
fontstyle = 0;
justification = 1;
width = 0;
ascent = 0;
maxAscent = 0;
descent = 0;
maxDescent = 0;
height = 0;
leading = 0;
parse = true;
lg = null;
list = new Vector(8, 4);
text = s;
}
public TextLine(String s, Font font1)
{
this(s);
font = font1;
if(font == null)
{
return;
} else
{
fontname = font1.getName();
fontstyle = font1.getStyle();
fontsize = font1.getSize();
return;
}
}
public TextLine(String s, Font font1, Color color1, int i)
{
this(s, font1);
color = color1;
justification = i;
}
public TextLine(String s, Color color1)
{
this(s);
color = color1;
}
public TextLine(Font font1, Color color1, int i)
{
script_fraction = 0.80000000000000004D;
sup_offset = 0.59999999999999998D;
sub_offset = 0.69999999999999996D;
font = null;
color = null;
background = null;
text = null;
fontname = "TimesRoman";
fontsize = 0;
fontstyle = 0;
justification = 1;
width = 0;
ascent = 0;
maxAscent = 0;
descent = 0;
maxDescent = 0;
height = 0;
leading = 0;
parse = true;
lg = null;
list = new Vector(8, 4);
font = font1;
color = color1;
justification = i;
if(font == null)
{
return;
} else
{
fontname = font1.getName();
fontstyle = font1.getStyle();
fontsize = font1.getSize();
return;
}
}
public TextLine copyState()
{
return new TextLine(font, color, justification);
}
public void copyState(TextLine textline)
{
if(textline == null)
return;
font = textline.getFont();
color = textline.getColor();
justification = textline.getJustification();
if(font == null)
{
return;
} else
{
fontname = font.getName();
fontstyle = font.getStyle();
fontsize = font.getSize();
parse = true;
return;
}
}
public void setFont(Font font1)
{
font = font1;
fontname = font1.getName();
fontstyle = font1.getStyle();
fontsize = font1.getSize();
parse = true;
}
public void setText(String s)
{
text = s;
parse = true;
}
public void setColor(Color color1)
{
color = color1;
}
public void setBackground(Color color1)
{
background = color1;
}
public void setJustification(int i)
{
switch(i)
{
case 0: // '\0'
justification = 0;
break;
case 1: // '\001'
default:
justification = 1;
break;
case 2: // '\002'
justification = 2;
break;
}
}
public Font getFont()
{
return font;
}
public String getText()
{
return text;
}
public Color getColor()
{
return color;
}
public Color getBackground()
{
return background;
}
public int getJustification()
{
return justification;
}
public FontMetrics getFM(Graphics g)
{
if(g == null)
return null;
if(font == null)
return g.getFontMetrics();
else
return g.getFontMetrics(font);
}
public int charWidth(Graphics g, char c)
{
if(g == null)
return 0;
FontMetrics fontmetrics;
if(font == null)
fontmetrics = g.getFontMetrics();
else
fontmetrics = g.getFontMetrics(font);
return fontmetrics.charWidth(c);
}
public int getWidth(Graphics g)
{
parseText(g);
return width;
}
public int getHeight(Graphics g)
{
parseText(g);
return height;
}
public int getAscent(Graphics g)
{
if(g == null)
{
return 0;
} else
{
parseText(g);
return ascent;
}
}
public int getMaxAscent(Graphics g)
{
if(g == null)
{
return 0;
} else
{
parseText(g);
return maxAscent;
}
}
public int getDescent(Graphics g)
{
if(g == null)
{
return 0;
} else
{
parseText(g);
return descent;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -