菜鸟求助:在 JAVA APPLET 里如何旋转 90 度显示一个字符?

icessl 2001-12-18 09:19:59
...全文
106 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
icessl 2002-01-01
  • 打赏
  • 举报
回复
谢谢
magus_yang 2001-12-18
  • 打赏
  • 举报
回复
down个jdk1.3.1装一下不就有了?
icessl 2001-12-18
  • 打赏
  • 举报
回复
to magus_yang(⊙杨⊙):
我用的是 VJ++6.0,没有 javax 包。能给我一个吗?
magus_yang 2001-12-18
  • 打赏
  • 举报
回复
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

class TextRotatePanel extends JPanel
{
public void paintComponent(Graphics g)
{
super.paintComponent(g);
Graphics2D g2=(Graphics2D)g;
g2.drawString("1.文本未旋转",10,100);
g2.rotate(3.1415926/2,100,100);
g2.drawString("2.文本顺时针旋转90度^_^",100,100);
g2.drawString("2.1 文本顺时针旋转90度^_^",110,120);
g2.drawString("2.2 文本顺时针旋转90度^_^",120,140);
g2.rotate(-(3.1415926/2),100,100);
g2.drawString("3.文本恢复水平",150,100);
g2.rotate(3.1415926/2,250,100);
g2.drawString("4.文本顺时针旋转90度^_^",250,100);

}
}

class TextRotateFrame extends JFrame
{
public TextRotateFrame()
{
setTitle("文本旋转");
setSize(400,300);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});

JTabbedPane tabPane=new JTabbedPane();
tabPane.addTab("1",new JPanel());
//tabPane.add(new TextRotatePanel(),"test"); //也可以
tabPane.addTab("test",new TextRotatePanel());

Container contentPane=getContentPane();
contentPane.add(tabPane);
}
}

public class TextRotate
{
public static void main(String[] args)
{
JFrame objFrame=new TextRotateFrame();
objFrame.show();
}
}
icessl 2001-12-18
  • 打赏
  • 举报
回复
另外,在 JAVA APPLET 里有没有取一个象素的函数(getPixel(x,y))?
magus_yang 2001-12-18
  • 打赏
  • 举报
回复
你使用任务管理器看的吧,这个我倒没有注意
overcast 2001-12-18
  • 打赏
  • 举报
回复
为什么我多次用了旋转之后
用资源管理器看用了100多M内存呢
不旋转是没有问题阿

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧