Exemplo n.º 1
0
 public EditorPanel getEditorPanelWithInstance() {
   EditorPanel thePanel = null;
   try {
     thePanel = new KeywordPanel();
     thePanel.edit(this);
   } catch (Exception ea) {
     ea.printStackTrace();
   }
   return (thePanel);
 }
Exemplo n.º 2
0
  /**
   * Cleans up the application (possibly asking the user if they want to save their changes) and
   * then exits it.
   */
  public void close() {
    // do some cleaning up.
    System.err.println("cleaning up before closing...");
    editorPanel.clean();

    // terminate.
    System.exit(0);
  }
Exemplo n.º 3
0
  public YarharMain() {
    super("YarHar!");
    int screenX = 1024;
    int screenY = 800;
    this.setSize(screenX, screenY);
    this.setJMenuBar(new YarharMenuBar(this));

    this.addWindowListener(this);
    this.addWindowFocusListener(this);

    this.add(borderPanel);

    toolsPanel = new ToolsPanel(this);
    //    borderPanel.add(toolsPanel, BorderLayout.NORTH);

    spriteLibPanel = new SpriteLibraryPanel(this);
    layersPanel = new LayersPanel(this);
    editorPanel = new EditorPanel(this);
    sidePane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, layersPanel, spriteLibPanel);
    sidePane.setContinuousLayout(true);
    sidePane.setResizeWeight(0.5);

    splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sidePane, editorPanel);
    splitPane.setContinuousLayout(true);
    splitPane.setResizeWeight(0.0);

    borderPanel.add(splitPane, BorderLayout.CENTER);

    footer = new StatusFooterPanel(this);
    borderPanel.add(footer, BorderLayout.SOUTH);

    // finishing touches on Game window
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setVisible(true);

    config = YarharConfig.load();

    System.err.println("Game Window successfully created!!!");

    editorPanel.start();

    // Swing can't correctly place divider locations on startup. So we must
    // set their locations later when everything else is initialized.
    javax.swing.SwingUtilities.invokeLater(
        new Runnable() {
          public void run() {
            setDividerLocations();
          }
        });
  }
 public void edit(InitVariableAction var) {
   variable = var;
   if (editor != null) varEditPane.remove((EditorPanel) editor);
   var.addVariableListener(variableListener);
   editor = var.getVariableEditor();
   varName.setText(var.getName());
   varName.repaint();
   if (editor != null) {
     editor.edit(var.getNewInitialization());
     varEditPane.add((EditorPanel) editor, BorderLayout.CENTER);
     varEditPane.revalidate();
     varEditPane.repaint();
   }
 }
 public void save() {
   if (editor != null) editor.save();
 }