【问题标题】:Graphics JPanel Sizing图形 JPanel 大小调整
【发布时间】:2018-10-23 08:34:03
【问题描述】:

我制作了一个海龟图形面板,它允许海龟从用户输入中移动,例如 forward <distance>、turnright、turnleft 等。但是,我不知道如何移动海龟,因为它被卡住了在屏幕的左上方。有谁知道我在代码上做错了什么并且可以为我调整它?我希望它直接在中心,笔向下

这是到目前为止应用程序的图片Turtle Graphics

头等舱

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;

/**
 * Represents the graphics display panel within the turtle program. This panel contains an image which is updated to reflect user commands.
 * 
 * 
 * 
 */
@SuppressWarnings("serial")
public class GraphicsPanel extends JPanel 
{

    private JTextField console = new JTextField(15);


       public static void main(String[] args) {


           SwingUtilities.invokeLater(new Runnable() {

       public void run() {

                 createAndShowGUI(); 
                }
            });
      }

       JMenuBar myMenuBar;
       JMenu file;
       JMenu help;
       JMenuItem load;
       JMenuItem save;



      private static void createAndShowGUI() {
          System.out.println("Created GUI on EDT? "+
          SwingUtilities.isEventDispatchThread());
          JFrame f = new JFrame("Turtle Graphics");
          f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
          f.add(new GraphicsPanel());
          f.pack();
          f.setVisible(true);
      } 


    /**
     * The default BG colour of the image.
     */
    private final static Color BACKGROUND_COL = Color.DARK_GRAY;
    private final static int TURTLE_X_SIZE = 8, TURTLE_Y_SIZE = 8;

    /**
     * The underlying image used for drawing. This is required so any previous drawing activity is persistent on the panel.
     */
    private BufferedImage image, turtleDisplay;

    //djm added
    private Color PenColour = Color.RED;
    private boolean penDown = false;
    private int xPos=0, yPos=0;
    private int direction = 180; //robot pointing down the screen;
    private JMenuItem newfile;
    private JMenuItem exit;
    private JMenuItem about;

        /**
     * Draw a line on the image using the given colour.
     * 
     * @param color
     * @param x1
     * @param y1
     * @param x2
     * @param y2
     */
    public void drawLine(Color color, int x1, int y1, int x2, int y2) 
    {

        Graphics g = image.getGraphics();
        g.setColor(color);
        g.drawLine(x1, y1, x2, y2);
    }

    //djm added commands
    public void penDown()
    {
        penDown = true;
    }

    public void penUp()
    {
        penDown = false;
    }

    public void turnRight()
    {
        direction +=90;
        if (direction >= 360)
            direction = 0;
    }

    public void turnLeft()
    {
        direction -=90;
        if (direction < 0)
            direction = 270;
    }

    public void forward(int distance)
    {
        //Graphics g = image.getGraphics();
        int x=xPos,y=yPos;
        //stored xPos and yPos are current location
        if (direction == 0) //robot facing up the screen, so forward subtracts y
        {
            y = yPos-distance;
        }
        else if (direction == 90) //robot facing right so forward add x
        {
            x = xPos + distance;
        }
        else if (direction == 180) //robot facing down the screen, so forwards adds to y
        {
            y = yPos + distance;
        }
        else if (direction == 270) //robot facing left, so forwards subtracts from x
        {
            x = xPos - distance;
        }
        else 
        {
            System.out.println("strange, shouldn't get here");
        }
        if (penDown)
        {
            //x=400; y=400;
            drawLine(PenColour, xPos, yPos, x, y);
            //g.drawLine(xPos,yPos,x,y);
        }
        //now robot has moved to the new position
        xPos = x;
        yPos = y;
    }

    /**
     * Clears the image contents.
     */
    public void clear() 
    {

        Graphics g = image.getGraphics();
        g.setColor(BACKGROUND_COL);
        g.fillRect(0, 0, image.getWidth(),  image.getHeight());
    }

    public void setTurtleColour(Color col)
    {
        Graphics g = turtleDisplay.getGraphics();
        g.setColor(col);
        g.fillRect(0, 0, turtleDisplay.getWidth(),  turtleDisplay.getHeight()); }

    public void green()
    {
        setTurtleColour(Color.GREEN);
        Graphics g = image.getGraphics();
        g.setColor(Color.GREEN);
        PenColour = Color.GREEN;

    }

    public void black()
    {
        setTurtleColour(Color.BLACK);
        Graphics g = image.getGraphics();
        g.setColor(Color.BLACK);
        PenColour = Color.BLACK;

    }


        @Override
         public void paintComponent(Graphics g) {
                super.paintComponent(g);
                g.drawImage(image, 0, 0, null);
                g.drawImage(turtleDisplay, xPos-TURTLE_X_SIZE/2, yPos-TURTLE_Y_SIZE/2, null);

 repaint();



        // render the image on the panel.
        g.drawImage(image, 0, 0, null);
        g.drawImage(turtleDisplay, xPos-TURTLE_X_SIZE/2, yPos-TURTLE_Y_SIZE/2, null); }




    /**
     * Constructor.
     */
    public GraphicsPanel() {
        add(console);

        console.addActionListener(new ActionListener()

                //Command List//

                {
                    public void actionPerformed(ActionEvent arg0) 
                    {
                        if (console.getText().contains("penup"))
                        {
                            penUp();
                        }
                        else if (console.getText().contains("pendown"))
                        {
                            penDown();
                        }
                        else if (console.getText().contains("turnleft"))
                        {
                            turnLeft();
                        }
                        else if (console.getText().contains("turnright"))
                        {
                            turnRight();
                        }
                        else if (console.getText().contains("forward"))
                        {
                            forward(direction);
                        }


                        else if (console.getText().contains("reset"))
                        {
                            clear();
                        }

                        else if (console.getText().contains("red"))
                        {
                            setTurtleColour(PenColour);
                        }

                        else if (console.getText().contains("green"))
                        {
                            green();
                        }

                        else if (console.getText().contains("black"))
                        {
                            black();
                        }

                        else
                        {
                            JOptionPane.showMessageDialog(console, "Invalid command, try again");
                        }

                        console.setText("");
                    }

                });

        myMenuBar = new JMenuBar ();
        file = new JMenu ("File");
        help = new JMenu("Help");
        load = new JMenuItem("Load");
        save = new JMenuItem("Save");
        newfile = new JMenuItem("New");
        exit = new JMenuItem("Exit");
        about = new JMenuItem("About");


        file.add(load);
        file.add(save);
        file.add(newfile);
        file.add(exit);
        help.add(about);

        myMenuBar.add(file);
        myMenuBar.add(help);

        add(myMenuBar);




        setBorder(BorderFactory.createLineBorder(Color.black));}


         public Dimension getPreferredSize() {
                return new Dimension(800,400);
         }
         {


        //main drawing area
        image = new BufferedImage(800, 400, BufferedImage.TYPE_INT_RGB);

        //small image to display on top of drawing area to represent the turtle
        turtleDisplay =  new BufferedImage(TURTLE_X_SIZE, TURTLE_Y_SIZE, BufferedImage.TYPE_INT_RGB);

        //set up turtle
        setTurtleColour(PenColour);

        // Set max size of the panel, so that is matches the max size of the image.
        setMaximumSize(new Dimension(image.getWidth(), image.getHeight()));
        setSize(800,400);
        setVisible(true);

        clear();
    }
}

二等

public class turtleClass {

    public static void main(String[] args) 
    {

        turtleClass m = new turtleClass();
        m.go();

    }

    public void go ()
    {
        GraphicsPanel p = new GraphicsPanel ();
        p.turnLeft();
        p.forward(100);
        p.turnRight();
        p.penDown();
        p.forward(400);
    }



}

【问题讨论】:

  • 请不要破坏您的问题。一旦您在本网站上提出问题,根据您在加入本网站时同意的服务条款,您的问题及其代码将成为本网站的财产。

标签: java oop jpanel turtle-graphics


【解决方案1】:

我会对此发表评论,但我没有足够的代表点数。

我没有看到你在你的任何方法之后调用 repaint(),所以这可能是问题所在。

~~编辑~~ 我能够在我的机器上修复你的代码,但我不得不改变整个结构,repaint() 方法是问题所在,但你也有很多结构问题。

这里有一个你应该如何构造它的例子,我创建了 1 个额外的文件来扩展 JFrame 并将你的 JPanel 添加到它我还删除了你在 JPanel 类中的 main 方法:

这是一个粗略的草拟,但我会让你处理其余的。

public class myFrame extends JFrame{

    public GraphicsPanel panel;

    public myFrame() {
         panel = new GraphicsPanel();
        add(panel);

    }

       public void go ()
        {
            panel.turnLeft();
            panel.forward(100);
            panel.turnRight();
            panel.penDown();
            panel.forward(400);
            repaint();
        }
}

没有 main 和其他一些修改的原始类

    /**
 * Represents the graphics display panel within the turtle program. This panel contains an image which is updated to reflect user commands.
 * 
 * 
 * 
 */
@SuppressWarnings("serial")
public class GraphicsPanel extends JPanel 
{

private JTextField console = new JTextField(15);

   JMenuBar myMenuBar;
   JMenu file;
   JMenu help;
   JMenuItem load;
   JMenuItem save;



/**
 * The default BG colour of the image.
 */
private final static Color BACKGROUND_COL = Color.DARK_GRAY;
private final static int TURTLE_X_SIZE = 8, TURTLE_Y_SIZE = 8;

/**
 * The underlying image used for drawing. This is required so any previous drawing activity is persistent on the panel.
 */
private BufferedImage image, turtleDisplay;

//djm added
private Color PenColour = Color.RED;
private boolean penDown = false;
private int xPos=0, yPos=0;
private int direction = 180; //robot pointing down the screen;
private JMenuItem newfile;
private JMenuItem exit;
private JMenuItem about;

    /**
 * Draw a line on the image using the given colour.
 * 
 * @param color
 * @param x1
 * @param y1
 * @param x2
 * @param y2
 */
public void drawLine(Color color, int x1, int y1, int x2, int y2) 
{

    Graphics g = image.getGraphics();
    g.setColor(color);
    g.drawLine(x1, y1, x2, y2);
}

//djm added commands
public void penDown()
{
    penDown = true;
}

public void penUp()
{
    penDown = false;
}

public void turnRight()
{
    direction +=90;
    if (direction >= 360)
        direction = 0;
}

public void turnLeft()
{
    direction -=90;
    if (direction < 0)
        direction = 270;
}

public void forward(int distance)
{
    //Graphics g = image.getGraphics();
    int x=xPos,y=yPos;
    //stored xPos and yPos are current location
    if (direction == 0) //robot facing up the screen, so forward subtracts y
    {
        y = yPos-distance;
    }
    else if (direction == 90) //robot facing right so forward add x
    {
        x = xPos + distance;
    }
    else if (direction == 180) //robot facing down the screen, so forwards adds to y
    {
        y = yPos + distance;
    }
    else if (direction == 270) //robot facing left, so forwards subtracts from x
    {
        x = xPos - distance;
    }
    else 
    {
        System.out.println("strange, shouldn't get here");
    }
    if (penDown)
    {
        //x=400; y=400;
        drawLine(PenColour, xPos, yPos, x, y);
        //g.drawLine(xPos,yPos,x,y);
    }
    //now robot has moved to the new position
    xPos = x;
    yPos = y;

}

/**
 * Clears the image contents.
 */
public void clear() 
{

    Graphics g = image.getGraphics();
    g.setColor(BACKGROUND_COL);
    g.fillRect(0, 0, image.getWidth(),  image.getHeight());
}

public void setTurtleColour(Color col)
{
    Graphics g = turtleDisplay.getGraphics();
    g.setColor(col);
    g.fillRect(0, 0, turtleDisplay.getWidth(),  turtleDisplay.getHeight()); }

public void green()
{
    setTurtleColour(Color.GREEN);
    Graphics g = image.getGraphics();
    g.setColor(Color.GREEN);
    PenColour = Color.GREEN;

}

public void black()
{
    setTurtleColour(Color.BLACK);
    Graphics g = image.getGraphics();
    g.setColor(Color.BLACK);
    PenColour = Color.BLACK;

}


    @Override
     public void paintComponent(Graphics g) {
            super.paintComponent(g);
            g.drawImage(image, 0, 0, null);
            g.drawImage(turtleDisplay, xPos-TURTLE_X_SIZE/2, yPos-TURTLE_Y_SIZE/2, null);



    // render the image on the panel.
    g.drawImage(image, 0, 0, null);
    g.drawImage(turtleDisplay, xPos-TURTLE_X_SIZE/2, yPos-TURTLE_Y_SIZE/2, null); }




/**
 * Constructor.
 */
public GraphicsPanel() {
    add(console);

    console.addActionListener(new ActionListener()

            //Command List//

            {
                public void actionPerformed(ActionEvent arg0) 
                {
                    if (console.getText().contains("penup"))
                    {
                        penUp();
                    }
                    else if (console.getText().contains("pendown"))
                    {
                        penDown();
                    }
                    else if (console.getText().contains("turnleft"))
                    {
                        turnLeft();
                    }
                    else if (console.getText().contains("turnright"))
                    {
                        turnRight();
                    }
                    else if (console.getText().contains("forward"))
                    {
                        forward(direction);
                    }


                    else if (console.getText().contains("reset"))
                    {
                        clear();
                    }

                    else if (console.getText().contains("red"))
                    {
                        setTurtleColour(PenColour);
                    }

                    else if (console.getText().contains("green"))
                    {
                        green();
                    }

                    else if (console.getText().contains("black"))
                    {
                        black();
                    }

                    else
                    {
                        JOptionPane.showMessageDialog(console, "Invalid command, try again");
                    }

                    console.setText("");
                }

            });

    myMenuBar = new JMenuBar ();
    file = new JMenu ("File");
    help = new JMenu("Help");
    load = new JMenuItem("Load");
    save = new JMenuItem("Save");
    newfile = new JMenuItem("New");
    exit = new JMenuItem("Exit");
    about = new JMenuItem("About");


    file.add(load);
    file.add(save);
    file.add(newfile);
    file.add(exit);
    help.add(about);

    myMenuBar.add(file);
    myMenuBar.add(help);

    add(myMenuBar);




    setBorder(BorderFactory.createLineBorder(Color.black));}


     public Dimension getPreferredSize() {
            return new Dimension(800,400);
     }
     {


    //main drawing area
    image = new BufferedImage(800, 400, BufferedImage.TYPE_INT_RGB);

    //small image to display on top of drawing area to represent the turtle
    turtleDisplay =  new BufferedImage(TURTLE_X_SIZE, TURTLE_Y_SIZE, BufferedImage.TYPE_INT_RGB);

    //set up turtle
    setTurtleColour(PenColour);

    // Set max size of the panel, so that is matches the max size of the image.
    setMaximumSize(new Dimension(image.getWidth(), image.getHeight()));
    setSize(800,400);
    setVisible(true);

    clear();
}

}

你的龟类

public class turtleClass {

public static void main(String[] args) 
{

    myFrame m = new myFrame();
    System.out.println("Created GUI on EDT? "+
            SwingUtilities.isEventDispatchThread());
            m.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
            m.pack();
                m.setVisible(true);
                m.go();

    }
}

【讨论】:

  • @Ben 看看我的编辑,看看你是否可以用我所做的更改来修复它,也许你可以在你的图形面板中添加一个构造函数并通过它设置初始值。
  • 嘿,没问题。我不完全确定将 main 方法放回代码中是什么意思。您的代码中有两个值: private boolean penDown = false;私人int xPos = 0,yPos = 0;尝试将这些更改为 true,并将屏幕宽度/2 和高度/2 设置为 xPos 和 yPos。
  • @Ben 这是您问题中给出此错误的代码吗?您是通过终端还是 IDE 运行它?确保您使用其中的 main 方法运行该类,即如果它是我发布的代码,请确保海龟类是您启动的类。
  • but I had to change the entire structure, the repaint() method is the problem, but you have quite a few structural problems as well. 是的,OP 在他的其他帖子中多次被告知:stackoverflow.com/questions/50308119/…
  • @Ben 很高兴我能帮上忙 :)
【解决方案2】:

当您完成对图形缓冲区的更改后,您需要调用repaint() 以使这些更改对用户可见。即使在更改笔颜色时,即使在我们绘制下一个东西之前颜色不会应用,我们调用repaint() 以便海龟光标本身以新颜色显示。 clear()、forward()(笔向上或向下)等也是如此。如果您的海龟光标具有非对称形状(例如箭头或实际海龟),那么即使 turnLeft() 和 turnRight() 也需要触发repaint() 显示新的海龟航向。

除了添加对repaint() 的缺失调用外,我还对您的代码进行了修改,以使您的命令正确运行:

GraphicsPanel.java

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JTextField;
import javax.swing.JOptionPane;
import javax.swing.BorderFactory;
import javax.swing.SwingUtilities;

/*
 * Represents the graphics display panel within the turtle program. This panel contains an image
 * which is updated to reflect user commands.
 */

public class GraphicsPanel extends JPanel 
{
    private JTextField console = new JTextField(15);

    public static void main(String[] args) {

        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                createAndShowGUI(); 
            }
        });
    }

    JMenuBar menuBar;
    JMenu file;
    JMenu help;
    JMenuItem load;
    JMenuItem save;

    private static void createAndShowGUI() {
        JFrame frame = new JFrame("Turtle Graphics");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
        frame.add(new GraphicsPanel());
        frame.pack();
        frame.setVisible(true);
    } 

    /*
     * The default BG colour of the image.
     */

    private final static Color BACKGROUND_COL = Color.DARK_GRAY;
    private final static int TURTLE_X_SIZE = 8, TURTLE_Y_SIZE = 8;

    /*
     * The underlying image used for drawing. This is required so 
     * any previous drawing activity is persistent on the panel.
     */

    private BufferedImage image, turtleDisplay;

    // djm added
    private Color PenColour = Color.RED;
    private boolean penDown = true;
    private int xPos = 400 - TURTLE_X_SIZE/2, yPos = 200 - TURTLE_Y_SIZE/2;
    private int direction = 180; // robot pointing down the screen
    private JMenuItem newfile;
    private JMenuItem exit;
    private JMenuItem about;
    private int distance = 100;

    /*
     * Draw a line on the image using the given colour.
     */

    public void drawLine(Color color, int x1, int y1, int x2, int y2) 
    {

        Graphics graphics = image.getGraphics();

        graphics.setColor(color);
        graphics.drawLine(x1, y1, x2, y2);
    }

    // djm added commands
    public void penDown()
    {
        penDown = true;
    }

    public void penUp()
    {
        penDown = false;
    }

    public void turnRight()
    {
        direction += 90;

        if (direction >= 360)
        {
            direction -= 360;
        }
    }

    public void turnLeft()
    {
        direction -= 90;

        if (direction < 0)
        {
            direction += 360;
        }
    }

    public void forward(int distance)
    {
        int x = xPos, y = yPos;

        // stored xPos and yPos are current location
        if (direction == 0) // robot facing up the screen, so forward subtracts y
        {
            y = yPos - distance;
        }
        else if (direction == 90) // robot facing right so forward add x
        {
            x = xPos + distance;
        }
        else if (direction == 180) // robot facing down the screen, so forwards adds to y
        {
            y = yPos + distance;
        }
        else if (direction == 270) // robot facing left, so forwards subtracts from x
        {
            x = xPos - distance;
        }
        else 
        {
            System.out.println("strange, shouldn't get here");
        }

        if (penDown)
        {
            drawLine(PenColour, xPos, yPos, x, y);
        }

        // now robot has moved to the new position
        xPos = x;
        yPos = y;

        repaint();
    }

    /*
     * Clear the image contents.
     */

    public void clear() 
    {
        Graphics graphics = image.getGraphics();

        graphics.setColor(BACKGROUND_COL);
        graphics.fillRect(0, 0, image.getWidth(), image.getHeight());

        repaint();
    }

    public void setColour(Color color)
    {
        Graphics graphics = turtleDisplay.getGraphics();
        graphics.setColor(color);
        graphics.fillRect(0, 0, turtleDisplay.getWidth(), turtleDisplay.getHeight());

        graphics = image.getGraphics();
        graphics.setColor(color);

        PenColour = color;

        repaint();
    }

    public void green()
    {
        setColour(Color.GREEN);
    }

    public void red()
    {
        setColour(Color.RED);
    }

    @Override
    public void paintComponent(Graphics graphics) {
        super.paintComponent(graphics);

        graphics.drawImage(image, 0, 0, null);
        graphics.drawImage(turtleDisplay, xPos - TURTLE_X_SIZE/2, yPos - TURTLE_Y_SIZE/2, null);
    }

    /*
     * Constructor.
     */

    public GraphicsPanel() {
        add(console);

        console.addActionListener(new ActionListener()

            /* Command List */

            {
                public void actionPerformed(ActionEvent arg0) 
                {
                    if (console.getText().contains("penup"))
                    {
                        penUp();
                    }
                    else if (console.getText().contains("pendown"))
                    {
                        penDown();
                    }
                    else if (console.getText().contains("turnleft"))
                    {
                        turnLeft();
                    }
                    else if (console.getText().contains("turnright"))
                    {
                        turnRight();
                    }
                    else if (console.getText().contains("forward"))
                    {
                        forward(distance);
                    }
                    else if (console.getText().contains("reset"))
                    {
                        clear();
                    }
                    else if (console.getText().contains("green"))
                    {
                        green();
                    }
                    else if (console.getText().contains("red"))
                    {
                        red();
                    }
                    else
                    {
                        JOptionPane.showMessageDialog(console, "Invalid command, try again");
                    }

                    console.setText("");
                }
            }
        );

        menuBar = new JMenuBar();

        file = new JMenu("File");

        load = new JMenuItem("Load");
        save = new JMenuItem("Save");
        newfile = new JMenuItem("New");
        exit = new JMenuItem("Exit");

        file.add(load);
        file.add(save);
        file.add(newfile);
        file.add(exit);

        menuBar.add(file);

        help = new JMenu("Help");

        about = new JMenuItem("About");

        help.add(about);

        menuBar.add(help);

        add(menuBar);

        setBorder(BorderFactory.createLineBorder(Color.black));
    }

    public Dimension getPreferredSize()
    {
        return new Dimension(800, 400);
    }

    {
        // main drawing area
        image = new BufferedImage(800, 400, BufferedImage.TYPE_INT_RGB);

        // small image to display on top of drawing area to represent the turtle
        turtleDisplay = new BufferedImage(TURTLE_X_SIZE, TURTLE_Y_SIZE, BufferedImage.TYPE_INT_RGB);

        // set up turtle
        setColour(PenColour);

        // Set max size of the panel, so that is matches the max size of the image.
        setMaximumSize(new Dimension(image.getWidth(), image.getHeight()));
        setSize(800, 400);
        setVisible(true);

        clear();
    }
}

TurtleClass.java

import java.awt.Graphics;

import javax.swing.JFrame;
import javax.swing.SwingUtilities;

public class TurtleClass extends JFrame {

    public static void main(String[] args) 
    {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                new TurtleClass();
            }
        });
    }

    public TurtleClass()
    {
        JFrame frame = new JFrame("Turtle Graphics");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        GraphicsPanel panel = new GraphicsPanel();

        frame.add(panel);
        frame.pack();
        frame.setVisible(true);

        panel.turnLeft();
        panel.forward(100);
        panel.turnRight();
        panel.penDown();
        panel.forward(400);
    }
}

您仍然可以按照最初的设计从 TurtleClass 或 GraphicsPanel 运行它:

当像 TurtleClass 那样作为 library 调用时,我会放弃控制台,但像 GraphicsPanel 那样作为 应用程序 调用时会保留它。根据需要,它可以既是输出设备又是交互式环境。

【讨论】:

  • @Ben,完成。但是,您应该足够了解您的代码,以便自己进行如此微不足道的更改。
猜你喜欢
  • 1970-01-01
  • 2013-11-12
  • 1970-01-01
  • 1970-01-01
  • 2015-10-25
  • 1970-01-01
  • 2012-05-24
  • 2012-05-16
  • 2011-05-17
相关资源
最近更新 更多