1个回答
展开全部
给些伪代码你:
class MyFrame extends JFrame
{
public static void main(String[] args)
{
MyFrame myFrame = new MyFrame();
Panel onePanel = new FontPanel();
myFrame.add(ontPanel);
myFrame.setVisible(true);
}
}
class FontPanel extends Panel
{
Color color;
Font font;
String input;
eventCatch(e)
{
if (e==changeColorEvent)
changeColor();
if (e==changeSizeEvent)
changeSize();
if(e==hasInput)
input = whatIsInput();
repaint();
}
void update(Graphics g)
{
g.setColor(color);
g.setFont(font);
g.drawString(input);
}
}
class MyFrame extends JFrame
{
public static void main(String[] args)
{
MyFrame myFrame = new MyFrame();
Panel onePanel = new FontPanel();
myFrame.add(ontPanel);
myFrame.setVisible(true);
}
}
class FontPanel extends Panel
{
Color color;
Font font;
String input;
eventCatch(e)
{
if (e==changeColorEvent)
changeColor();
if (e==changeSizeEvent)
changeSize();
if(e==hasInput)
input = whatIsInput();
repaint();
}
void update(Graphics g)
{
g.setColor(color);
g.setFont(font);
g.drawString(input);
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询