public void actionPerformed(ActionEvent e) { // Return a fileName
   String fileName = "WeAreTheChampions";
   String songorAuthor = "S";
   gui.setAuthororSinger(songorAuthor);
   gui.updateFileName(fileName);
   gui.updateState(true);
 }
Exemplo n.º 2
0
    @Override
    public void execute(final GUI gui) {
      final boolean rt = gui.gprop.invert(GUIProp.FILTERRT);
      gui.stop();
      // refresh buttons in input bar
      gui.refreshControls();
      // refresh editor buttons
      gui.editor.refreshMark();

      final Context ctx = gui.context;
      final boolean root = ctx.root();
      final Data data = ctx.data();
      if (!rt) {
        if (!root) {
          gui.notify.context(new Nodes(0, data), true, null);
          gui.notify.mark(ctx.current(), null);
        }
      } else {
        if (root) {
          gui.notify.mark(new Nodes(data), null);
        } else {
          final Nodes mark = ctx.marked;
          ctx.marked = new Nodes(data);
          gui.notify.context(mark, true, null);
        }
      }
    }
Exemplo n.º 3
0
  public static void main(String[] args) {
    GUI dialog = new GUI();

    dialog.pack();
    dialog.setVisible(true);
    System.exit(0);
  }
 /** run method for class */
 public void run() {
   GUI gui = (GUI) registeredObject;
   GPane pane = gui.getTopPane();
   pane.setMode(GPane.DRAW_MARKER_MODE);
   super.setSelected(true);
   gui.getNotifier().firePaneEvent(this);
   gui.getProgressMeter().getPanel().repaint();
 }
Exemplo n.º 5
0
 /**
  * Sets the current theme.
  *
  * @param theme the new theme
  */
 public static void setTheme(Themes theme) {
   currentTheme = theme;
   System.out.println(theme.getName());
   // activate current theme
   GUI.resetLookAndFeel(); // wipes the slate clean
   theme.doColoring();
   GUI.setNimbusLookAndFeel(); // puts nimbus back on
 }
Exemplo n.º 6
0
 @Override
 public void execute(final GUI gui) {
   gui.gprop.invert(GUIProp.EXECRT);
   gui.stop();
   // refresh buttons in input bar
   gui.refreshControls();
   // refresh editor buttons
   gui.editor.refreshMark();
 }
Exemplo n.º 7
0
 public static void saveAsPlaylist(String message) throws Exception {
   if (logger.isDebugEnabled()) logger.debug("Save as playlist.");
   String s = GUI.messageDialog2(message);
   if (s != null) {
     String s2 =
         Lecteur.CURRENTPLAYLIST.NAME.substring(0, Lecteur.CURRENTPLAYLIST.NAME.length() - 19);
     String sa = s2 + s + ".pl";
     File f = new File(sa);
     copy(new File(Lecteur.CURRENTPLAYLIST.NAME), f);
     currentNAME = f.toString();
     GUI.getInstance().createOpenItem(sa);
     GUI.getInstance().createdeleteItem(sa);
   }
 }
  /** run method for class */
  public void run() {
    GUI gui = (GUI) registeredObject;
    GPane pane = gui.getTopPane();

    int increments = 10;
    for (int i = 0; i < increments; i++)
      gui.getGMap()
          .getGDraw()
          .add(
              new GLine(
                  new GPhysicalPoint((90 / increments) * i, -170.0),
                  new GPhysicalPoint((90 / increments) * i, 170.0)));

    pane.draw();
  }
 protected JButton createButton(String icon, String text, String command) {
   if (listener == null) {
     listener =
         new ActionListener() {
           public void actionPerformed(ActionEvent e) {
             if (e.getActionCommand().equals(ADD)) {
               addItem();
             } else if (e.getActionCommand().equals(REMOVE)) {
               removeItem();
             } else if (e.getActionCommand().equals(UP)) {
               moveItemUp();
             } else if (e.getActionCommand().equals(DOWN)) {
               moveItemDown();
             }
           }
         };
   }
   ToolbarButton button = new ToolbarButton();
   if (icon != null) {
     button.setIcon(GUI.getIcon(icon));
   }
   if (text != null) {
     button.setText(text);
   } else {
     button.setMargin(GUI.noInsets);
     button.setToolTipText(command);
   }
   button.setEnabled(false);
   button.setActionCommand(command);
   button.addActionListener(listener);
   buttons.put(command, button);
   return button;
 }
Exemplo n.º 10
0
 /**
  * Method to set the boolean value of whether the menu action removeObject is enabled or not
  * depending if the right click occured on an object.
  */
 public void update() {
   if (gui.getGMap().getGDraw().getSelected().getSize() == 0) {
     removeObject.setEnabled(false);
   } else {
     removeObject.setEnabled(true);
   }
 }
Exemplo n.º 11
0
  @Override
  public void actionPerformed(ActionEvent e) {
    parent.newGame(
        (int) numAI.getValue(),
        AIPlayer.Difficulty.valueOf(chooseDifficulty.getSelection().getActionCommand()));

    this.dispose();
  }
Exemplo n.º 12
0
 private void repaint() {
   if (mPainter != null) {
     if (DEBUG.IMAGE) out("repaint in " + GUI.name(mPainter));
     mPainter.repaint();
   }
   // FYI, this will not repaint if the parent is a DefaultTreeCellRenderer,
   // and the parent of the parent (a JLabel), is null, so we can't get that.
 }
Exemplo n.º 13
0
 private void apply() {
   int size = getPanelsSize();
   for (int i = 0; i < size; i++) {
     getPanel(i).apply();
   }
   // System.out.println("apply from dialog");
   gui.getTopPane().draw();
 }
Exemplo n.º 14
0
 /**
  * Creates and shows an alert dialog.
  *
  * @param frame the parent frame. Can be null.
  * @param whatToSay the body of the dialog.
  * @param title the title of the dialog.
  * @param iconPath the icon's name (x.png)
  */
 public static void showDialog(JFrame frame, String whatToSay, String title, String iconPath) {
   JOptionPane.showMessageDialog(
       frame, // parent
       whatToSay, // text
       title, // title
       JOptionPane.INFORMATION_MESSAGE, // mesage type
       GUI.createImageIcon(iconPath) // icon
       );
 }
Exemplo n.º 15
0
  /** Check mandatory and isEditable to set color settings. */
  protected void performFlags() {
    Assert.isNotNull(moneyField);
    Assert.isNotNull(flagLabel);

    if (isReadonly()) {
      moneyField.setBackground(SystemColor.control);
      flagLabel.setIcon(GUI.getOptionalIcon());
    } else {
      // @todo find appropriate system color
      moneyField.setBackground(Color.white);

      if (mandatory && getObjectValue() == null) {
        flagLabel.setIcon(GUI.getMandatoryIcon());
      } else {
        flagLabel.setIcon(GUI.getOptionalIcon());
      }
    }
  }
Exemplo n.º 16
0
 public ResourceIcon(Resource r, int width, int height, Component painter) {
   setSize(width, height);
   // StatusLabel.setVisible(false);
   // add(StatusLabel);
   // loadResource(r);
   mResource = r;
   mPainter = painter;
   if (DEBUG.IMAGE)
     out("Constructed " + width + "x" + height + " " + r + " painter=" + GUI.namex(painter));
 }
Exemplo n.º 17
0
  public void readFile() throws IOException {
    try {

      FileInputStream fstream = new FileInputStream("dataIn.txt");
      DataInputStream in = new DataInputStream(fstream);
      BufferedReader br = new BufferedReader(new InputStreamReader(in));

      String strLine;
      int memi = -1;
      int strLineMemory = 59;

      while ((strLine = br.readLine()) != null) {

        t.data[strLineMemory++][1] = String.valueOf(strLine);
        memi++;

        size++;
        while ((strLine = br.readLine()) != null && !strLine.startsWith("*")) {

          String[] arr = strLine.split(" ");
          String command = arr[0];
          String operand = arr[1];

          toMemory(command, operand, memarray[memi]);
          memarray[memi] = memarray[memi] + 2;
          System.out.printf("%s %s ", command, operand);
        }
      }

      in.close();
    } catch (Exception e) { // Catch exception if any
      System.err.println("Error: " + e.getMessage());
    }

    MOSMain mos = new MOSMain();
    mos.planner();

    t.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    t.setSize(830, 800);
    t.setVisible(true);
    t.setTitle("Printer");
    sortTime();
  }
Exemplo n.º 18
0
 @Override
 public void execute(final GUI gui) {
   final StringBuilder sb = new StringBuilder();
   final Nodes n = gui.context.copied;
   for (int i = 0; i < n.size(); ++i) {
     if (i > 0) sb.append(',');
     sb.append(openPre(n, i));
   }
   gui.context.copied = null;
   gui.execute(new XQuery("insert nodes (" + sb + ") into " + openPre(gui.context.marked, 0)));
 }
Exemplo n.º 19
0
    @Override
    public void execute(final GUI gui) {
      final Nodes n = gui.context.marked;
      final DialogEdit edit = new DialogEdit(gui, n.pres[0]);
      if (!edit.ok()) return;

      String rename = null;
      String replace = null;
      final int k = edit.kind;
      if (k == Data.ELEM || k == Data.PI || k == Data.ATTR) {
        rename = edit.result.get(0);
        if (k != Data.ELEM) replace = edit.result.get(1);
      } else {
        replace = edit.result.get(0);
      }

      if (rename != null)
        gui.execute(new XQuery("rename node " + openPre(n, 0) + " as " + quote(rename)));
      if (replace != null)
        gui.execute(
            new XQuery("replace value of node " + openPre(n, 0) + " with " + quote(replace)));
    }
Exemplo n.º 20
0
 @Override
 public void execute(final GUI gui) {
   if (!BaseXDialog.confirm(gui, DELETE_NODES)) return;
   final StringBuilder sb = new StringBuilder();
   final Nodes n = gui.context.marked;
   for (int i = 0; i < n.size(); ++i) {
     if (i > 0) sb.append(',');
     sb.append(openPre(n, i));
   }
   gui.context.marked = new Nodes(n.data);
   gui.context.copied = null;
   gui.context.focused = -1;
   gui.execute(new XQuery("delete nodes (" + sb + ')'));
 }
 public ModelElementsPropertiesPanel() {
   setLayout(new BorderLayout(GUI.HorizontalWidgetDistance, 0));
   setBorder(GUI.getEmptyPanelBorder());
   toolbar = createToolbar();
   if (toolbar != null) {
     add(toolbar, BorderLayout.NORTH);
   }
   Component details = createDetailsPanel();
   if (details != null) {
     add(details);
   }
   Component list = createListPanel();
   if (list != null) {
     add(list, BorderLayout.WEST);
   }
 }
Exemplo n.º 22
0
 @Override
 public void execute(final GUI gui) {
   // skip operation for root context
   final Context ctx = gui.context;
   if (ctx.root()) return;
   // check if all nodes are document nodes
   boolean doc = true;
   final Data data = ctx.data();
   for (final int pre : ctx.current().pres) doc &= data.kind(pre) == Data.DOC;
   if (doc) {
     // if yes, jump to database root
     ctx.update();
     gui.notify.context(ctx.current(), false, null);
   } else {
     // otherwise, jump to parent nodes
     gui.execute(new Cs(".."));
   }
 }
Exemplo n.º 23
0
  /**
   * Draws an emblem (based on current theme) in the bottom left of the given component. Call this
   * in paintComponent() of the component.
   *
   * @param component the component to draw on
   * @param g the Graphics object from paintComponent()
   */
  public static void drawEmblem(JComponent component, Graphics g) {
    Themes currentTheme = Themes.getCurrentTheme();
    ImageIcon image = GUI.createImageIcon("translucent/" + currentTheme.getImageIconPath());

    /*if(Themes.getCurrentTheme() == Themes.SNOW){
        image = GUI.createImageIcon("translucent/snow.png");
    }*/

    int imageWidth = image.getIconWidth();
    int imageHeight = image.getIconHeight();
    // top left corner of where to start drawing
    int topLeftX = component.getWidth() - imageWidth; // x (horizontal) coordinate
    int topLeftY = component.getHeight() - imageHeight; // y (vertical) coordinate

    // draw in bottom right corner
    g.drawImage(image.getImage(), topLeftX, topLeftY, (java.awt.image.ImageObserver) null);
    // g.drawImage(image.getImage(), 0,0, (java.awt.image.ImageObserver)null);
  }
Exemplo n.º 24
0
    @Override
    public void execute(final GUI gui) {
      final Nodes n = gui.context.marked;
      final DialogInsert insert = new DialogInsert(gui);
      if (!insert.ok()) return;

      final StringList sl = insert.result;
      final NodeType type = ANode.type(insert.kind);
      String item = Token.string(type.string()) + " { " + quote(sl.get(0)) + " }";

      if (type == NodeType.ATT || type == NodeType.PI) {
        item += " { " + quote(sl.get(1)) + " }";
      } else if (type == NodeType.ELM) {
        item += " { () }";
      }

      gui.context.copied = null;
      gui.execute(new XQuery("insert node " + item + " into " + openPre(n, 0)));
    }
Exemplo n.º 25
0
  @Override
  public void paintComponent(Graphics g) {
    super.paintComponent(g);

    // resize picture to appropriate size
    ImageIcon newPicture = GUI.scaleImage(picture, PICTURE_WIDTH, PICTURE_HEIGHT);

    int width = newPicture.getIconWidth();
    int height = newPicture.getIconHeight();

    // get offsets in order to center picture
    int verticalOffset = (PICTURE_HEIGHT - height) / 2;
    int horizontalOffset = (PICTURE_WIDTH - width) / 2;
    // if the image is thinner than this panel, offset it

    // paint the picture
    g.drawImage(newPicture.getImage(), horizontalOffset, verticalOffset, this);
    // offsets let the image be centered
  }
Exemplo n.º 26
0
  /**
   * The GPropertiesDialog class constructor.
   *
   * @param gui the GUI class
   */
  public GPropertiesDialog(GUI gui) {
    // superclass constructor
    super(gui, "Properties", false);
    objects = new ObjectContainer();

    // gui
    this.gui = gui;

    // set the fixed size
    setSize(260, 350);
    setResizable(false);
    setLayout(null);

    // set up panels for stuff
    pane = new JTabbedPane();

    // add the tabbed panel
    tabbedPanePanel = new JPanel();
    tabbedPanePanel.add(pane);
    tabbedPanePanel.setLayout(null);
    this.getContentPane().add(tabbedPanePanel);
    tabbedPanePanel.setBounds(0, 0, this.getWidth(), 280);
    pane.setBounds(0, 0, tabbedPanePanel.getWidth(), tabbedPanePanel.getHeight());

    // set up buttons
    apply = new JButton("Apply");
    apply.setBounds(150, 290, 80, 26);
    this.getContentPane().add(apply);

    close = new JButton("Close");
    close.setBounds(50, 290, 80, 26);
    this.getContentPane().add(close);

    addPanel(new GPropertiesPanelCustomObject(gui.getGMap()), "Object");

    // add listeners
    addMouseListener(this);
    apply.addItemListener(this);
    apply.addActionListener(this);
    close.addItemListener(this);
    close.addActionListener(this);
  }
Exemplo n.º 27
0
  /**
   * Uses a JEditorPane to open the given URL in a dialog
   *
   * @param url the url to load
   * @param title the title of the dialog
   * @param frame the parent frame
   * @param visible true if you want the dialog to be visible, false if you want it to be invisible
   *     to user
   * @param iconPath the path to the image icon for the dialog.
   */
  public static void openURLinDialog(
      String url, String title, String iconPath, JFrame frame, boolean visible) {
    // create panel with page in it
    final int WIDTH = 400;
    final int HEIGHT = 300;
    JPanel webView = createEditorPane(url, WIDTH, HEIGHT);

    // put it in a dialog
    JDialog dialog = new JDialog(frame);
    dialog.setTitle(title);
    dialog.setIconImage(GUI.createImageIcon(iconPath).getImage());
    dialog.setContentPane(webView);
    dialog.pack();
    dialog.setResizable(false);
    dialog.setModal(true);
    Utils.centerComponent(dialog, frame);

    // open it
    dialog.setVisible(visible);
  }
Exemplo n.º 28
0
  public MainDialog() throws HeadlessException {
    super("Jenkins slave agent");

    ImageIcon background = new ImageIcon(getClass().getResource("title.png"));

    JPanel foregroundPanel = new JPanel(new BorderLayout(10, 10));
    foregroundPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    foregroundPanel.setOpaque(false);

    statusLabel = new JLabel("", JLabel.TRAILING);
    foregroundPanel.add(statusLabel, BorderLayout.CENTER);

    setContentPane(
        GUI.wrapInBackgroundImage(foregroundPanel, background, JLabel.BOTTOM, JLabel.LEADING));
    resetMenuBar();

    pack();

    setSize(new Dimension(250, 150));
    getContentPane().setBackground(Color.WHITE);

    setLocationByPlatform(true);
    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  }
Exemplo n.º 29
0
/** Created by sattas on 3/28/14. */
public class InputData {

  GUI t = GUI.getInstance();
  public static int size = 0;
  public static ArrayList timeList = new ArrayList();
  public static final int[] memarray =
      new int[] {255, 511, 767, 1023, 1279, 1535, 1791, 2047, 2303, 2559, 2815, 3071};

  public void readFile() throws IOException {
    try {

      FileInputStream fstream = new FileInputStream("dataIn.txt");
      DataInputStream in = new DataInputStream(fstream);
      BufferedReader br = new BufferedReader(new InputStreamReader(in));

      String strLine;
      int memi = -1;
      int strLineMemory = 59;

      while ((strLine = br.readLine()) != null) {

        t.data[strLineMemory++][1] = String.valueOf(strLine);
        memi++;

        size++;
        while ((strLine = br.readLine()) != null && !strLine.startsWith("*")) {

          String[] arr = strLine.split(" ");
          String command = arr[0];
          String operand = arr[1];

          toMemory(command, operand, memarray[memi]);
          memarray[memi] = memarray[memi] + 2;
          System.out.printf("%s %s ", command, operand);
        }
      }

      in.close();
    } catch (Exception e) { // Catch exception if any
      System.err.println("Error: " + e.getMessage());
    }

    MOSMain mos = new MOSMain();
    mos.planner();

    t.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    t.setSize(830, 800);
    t.setVisible(true);
    t.setTitle("Printer");
    sortTime();
  }

  public void toMemory(String command, String operand, int place) {

    if (GUI.data[place][1].equals("0")) {
      GUI.data[place][1] = command;
      GUI.data[place + 1][1] = operand;
      t.textfieldIC.setText("80");
      t.textfieldTI.setText("10");
    }

    t.textfieldMODE.setText("V");
    // pradiniai duomenys

    t.data[0][1] = "6"; // sokti, jei iskilo PI inerrupt
    t.data[1][1] = "18"; // sokti, jei iskilo SI inerrupt
    t.data[2][1] = "28"; // sokti, jei iskilo TI inerrupt
    t.data[3][1] = "38"; // sokti, jei iskilo IOI inerrupt

    // jei iskilo PI interupt:
    t.data[6][1] = "MVR1";
    t.data[7][1] = "48";
    t.data[8][1] = "LR1";
    t.data[9][1] = "17";
    t.data[10][1] = "MVR2";
    t.data[11][1] = "23";
    t.data[12][1] = "AD1";
    t.data[13][1] = "17";
    t.data[14][1] = "exit";

    // jei iskilo SI interupt:
    t.data[18][1] = "MVR1";
    t.data[19][1] = "478";
    t.data[20][1] = "LR1";
    t.data[21][1] = "27";
    t.data[22][1] = "MVR2";
    t.data[23][1] = "95";
    t.data[24][1] = "AD1";
    t.data[25][1] = "27";
    t.data[26][1] = "exit";

    // jei iskilo TI interupt:
    t.data[28][1] = "MVR1";
    t.data[29][1] = "72";
    t.data[30][1] = "LR1";
    t.data[31][1] = "37";
    t.data[32][1] = "MVR2";
    t.data[33][1] = "24";
    t.data[34][1] = "AD1";
    t.data[35][1] = "37";
    t.data[36][1] = "exit";

    // jei iskilo IOI interupt:
    t.data[38][1] = "MVR1";
    t.data[39][1] = "486";
    t.data[40][1] = "LR1";
    t.data[41][1] = "49";
    t.data[42][1] = "MVR2";
    t.data[43][1] = "64";
    t.data[44][1] = "AD1";
    t.data[45][1] = "49";
    t.data[46][1] = "exit";
  }

  public void sortTime() {
    int i = 59;
    // int [] temp = new int[InputData.size];

    while (Integer.valueOf(t.data[i][1]) != 0) {
      timeList.add(Integer.valueOf(t.data[i][1]));
      i++;
    }
    i = 59;

    Collections.sort(timeList);

    // return(temp);

    // System.out.println(getMinValue(temp));
    // for (int a=0;a<InputData.size;a++){
    //	data[i][1] = String.valueOf(temp[a]);
    //	i++;
    // }
  }
}
Exemplo n.º 30
0
  /*@Override*/ public void paintIcon(Component c, Graphics g, int x, int y) {
    final boolean expandToFit = (mWidth < 1);

    if (DEBUG.IMAGE && DEBUG.META)
      out(
          "paintIcon; onto="
              + GUI.name(c)
              + " painter="
              + GUI.name(mPainter)
              + "@"
              + Integer.toHexString((mPainter.hashCode())));

    if (mPainter == null) {
      // note this means repaint updates would stop in a new parent,
      // tho assuming it's loaded by then, regular paints would work fine.
      mPainter = c;
    }

    if (DrawBorder && !expandToFit) {
      g.setColor(Color.gray);
      g.drawRect(x, y, mWidth - 1, mHeight - 1);
    }

    if (mImage == null) {

      if (!isLoading /*&& mPreviewData != null*/) {
        synchronized (this) {
          if (!isLoading /*&& mPreviewData != null*/)
            VUE.invokeAfterAWT(ResourceIcon.this); // load the preview
        }
      }
      g.setColor(Color.gray);
      g.drawRect(x, y, mWidth - 1, mHeight - 1);
      return;
    }

    int fitWidth, fitHeight;
    final Dimension maxImageSize;

    if (expandToFit) {
      // fill the given component
      fitWidth = c.getWidth();
      fitHeight = c.getHeight();
      maxImageSize = c.getSize();
    } else {
      // paint at our fixed size
      fitWidth = mWidth;
      fitHeight = mHeight;

      if (DrawBorder)
        maxImageSize = new Dimension(fitWidth - BorderSpace * 2, fitHeight - BorderSpace * 2);
      else maxImageSize = new Dimension(fitWidth, fitHeight);

      if (DEBUG.IMAGE && DEBUG.META) out("paintIcon; into " + GUI.name(maxImageSize));
    }

    double zoomFit;
    if (mImage == NoImage && expandToFit) {
      zoomFit = 1;
    } else {
      Rectangle2D imageBounds;
      if (CropToSquare) {
        // square off image, then fit in icon (todo: better; crop to icon)
        int smallestAxis = mImageWidth > mImageHeight ? mImageHeight : mImageWidth;
        imageBounds = new Rectangle2D.Float(0, 0, smallestAxis, smallestAxis);
      } else {
        // fit entire image in icon
        imageBounds = new Rectangle2D.Float(0, 0, mImageWidth, mImageHeight);
      }
      zoomFit = ZoomTool.computeZoomFit(maxImageSize, 0, imageBounds, null, false);
      if (zoomFit > MaxZoom) zoomFit = MaxZoom;
    }

    final int drawW = (int) (mImageWidth * zoomFit + 0.5);
    final int drawH = (int) (mImageHeight * zoomFit + 0.5);

    int xoff = x;
    int yoff = y;

    // center if drawable area is bigger than image
    if (drawW != fitWidth) xoff += (fitWidth - drawW) / 2;
    if (drawH != fitHeight) yoff += (fitHeight - drawH) / 2;

    Shape oldClip = null;
    if (CropToSquare && !expandToFit) {
      oldClip = g.getClip();
      g.clipRect(x, y, mWidth, mHeight);
    }

    if (DEBUG.IMAGE && DEBUG.META)
      out("paintIcon; " + Util.tag(mImage) + " as " + drawW + "x" + drawH);
    g.drawImage(mImage, xoff, yoff, drawW, drawH, null);

    if (DEBUG.BOXES) {
      g.setColor(Color.green);
      ((Graphics2D) g)
          .setComposite(
              java.awt.AlphaComposite.getInstance(java.awt.AlphaComposite.SRC_OVER, 0.2f));
      g.drawRect(x, y, mWidth - 1, mHeight - 1);
      ((Graphics2D) g).setComposite(java.awt.AlphaComposite.SrcOver);
    }

    if (CropToSquare && !expandToFit) g.setClip(oldClip);
  }