예제 #1
0
 public void paintIcon(Component c, Graphics g, int x, int y) {
   if (WindowsMenuItemUI.isVistaPainting()) {
     XPStyle xp = XPStyle.getXP();
     State state = State.NORMAL;
     if (c instanceof JMenuItem) {
       state = ((JMenuItem) c).getModel().isEnabled() ? State.NORMAL : State.DISABLED;
     }
     Skin skin = xp.getSkin(c, Part.MP_POPUPSUBMENU);
     if (WindowsGraphicsUtils.isLeftToRight(c)) {
       skin.paintSkin(g, x, y, state);
     } else {
       Graphics2D g2d = (Graphics2D) g.create();
       g2d.translate(x + skin.getWidth(), y);
       g2d.scale(-1, 1);
       skin.paintSkin(g2d, 0, 0, state);
       g2d.dispose();
     }
   } else {
     g.translate(x, y);
     if (WindowsGraphicsUtils.isLeftToRight(c)) {
       g.drawLine(0, 0, 0, 7);
       g.drawLine(1, 1, 1, 6);
       g.drawLine(2, 2, 2, 5);
       g.drawLine(3, 3, 3, 4);
     } else {
       g.drawLine(4, 0, 4, 7);
       g.drawLine(3, 1, 3, 6);
       g.drawLine(2, 2, 2, 5);
       g.drawLine(1, 3, 1, 4);
     }
     g.translate(-x, -y);
   }
 }
예제 #2
0
 public int getIconHeight() {
   if (WindowsMenuItemUI.isVistaPainting()) {
     Skin skin = XPStyle.getXP().getSkin(null, Part.MP_POPUPSUBMENU);
     return skin.getHeight();
   } else {
     return 8;
   }
 }
예제 #3
0
 public void setSkin(Skin skin)
 {
     this.skin = skin;
     this.setToolTipText(skin != null? skin.getName(): null);
     btnAdd.setVisible(last && skin == null);
     this.repaint();
     
     if(skin != null)
     {
         skin.setUnit(this);
         this.setFirst(skin.isDefault());
     }
 }
예제 #4
0
파일: GUI.java 프로젝트: w4ll3/ppioo-1
  private static void loadButtons(Skin skin) {
    TextButtonStyle textButtonStyle;

    for (ColorEnum color : ButtonEnum.colors) {
      for (LabelEnum size : ButtonEnum.sizes) {
        for (ButtonEnum button : ButtonEnum.values()) {
          textButtonStyle = new TextButtonStyle();
          textButtonStyle.font = skin.getFont(size.fontName);
          textButtonStyle.fontColor = color.getColor();
          textButtonStyle.up = skin.getDrawable(button.type + ".up");
          textButtonStyle.over = skin.getDrawable(button.type + ".over");
          textButtonStyle.down = skin.getDrawable(button.type + ".down");
          if (ButtonEnum.defaultColor == color) {
            if (ButtonEnum.defaultSize == size) {
              skin.add(button.type, textButtonStyle);
            }
            skin.add(button.type + "." + size.fontName, textButtonStyle);
          }
          skin.add(button.type + "." + size.fontName + "." + color.colorName, textButtonStyle);
        }
      }
    }

    skin.add("default", skin.get("default.default.black", TextButtonStyle.class));
  }
예제 #5
0
 public int getIconHeight() {
   Icon lafIcon = getLaFIcon();
   if (lafIcon != null) {
     return lafIcon.getIconHeight();
   }
   Icon icon = getIcon();
   int height = 0;
   if (icon != null) {
     height = icon.getIconHeight() + 2 * OFFSET;
   } else {
     Skin skin = XPStyle.getXP().getSkin(null, Part.MP_POPUPCHECK);
     height = skin.getHeight() + 2 * OFFSET;
   }
   return height;
 }
예제 #6
0
  private void updateTabBar(Vector vtThread) {
    pnlThread.removeAll();
    for (int iThreadIndex = 0; iThreadIndex < vtThread.size(); iThreadIndex++) {
      try {
        Vector vtThreadInfo = (Vector) vtThread.elementAt(iThreadIndex);
        PanelThreadMonitor mntTemp = new PanelThreadMonitor(channel);

        String strThreadID = (String) vtThreadInfo.elementAt(0);
        String strThreadName = (String) vtThreadInfo.elementAt(1);
        int iThreadStatus = Integer.parseInt((String) vtThreadInfo.elementAt(2));
        mntTemp.setThreadID(strThreadID);
        mntTemp.setThreadName(strThreadName);
        mntTemp.setThreadStatus(iThreadStatus);
        showResult(mntTemp.txtMonitor, (String) vtThreadInfo.elementAt(3));
        mntTemp.addPropertyChangeListener(this);

        pnlThread.add(strThreadName, mntTemp);
        mntTemp.updateStatus();
      } catch (Exception e) {
        e.printStackTrace();
        MessageBox.showMessageDialog(this, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE);
      }
    }
    Skin.applySkin(this);
  }
예제 #7
0
 public void updateUI() {
   super.updateUI();
   if (pmn != null) {
     SwingUtilities.updateComponentTreeUI(pmn);
     Skin.applySkin(pmn);
   }
 }
 @Override
 public JsonNode toJsonNode() {
   final ObjectNode node = OM.createObjectNode();
   node.put(CURRENTCONTROL, currentcontrol.toJsonNode());
   node.put(CURRENTWINDOW, currentwindow.toJsonNode());
   node.put(FULLSCREEN, fullscreen);
   node.put(SKIN, skin.toJsonNode());
   return node;
 }
예제 #9
0
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   Skin.getFallbackInstance().resetDrawableFactory();
   for (SkinType skinType : SkinType.values()) {
     skinType
         .getSkin(getInstrumentation().getTargetContext().getResources())
         .resetDrawableFactory();
   }
 }
예제 #10
0
 public StatusIcon(int label_width, Quad icon, String tooltip) {
   this.tooltip = tooltip;
   setDim(icon.getWidth() + label_width, icon.getHeight());
   setCanFocus(true); // only to enable tool tips. focus is given to delegate
   this.icon_quad = icon;
   label = new Label("", Skin.getSkin().getEditFont(), label_width, Label.ALIGN_RIGHT);
   addChild(label);
   //		label.setPos(icon.getWidth(), (getHeight() - label.getFont().getHeight())/2);
   label.setPos(0, (getHeight() - label.getFont().getHeight()) / 2);
 }
예제 #11
0
 public void paintIcon(Component c, Graphics g, int x, int y) {
   Icon lafIcon = getLaFIcon();
   if (lafIcon != null) {
     lafIcon.paintIcon(c, g, x, y);
     return;
   }
   assert menuItem == null || c == menuItem;
   Icon icon = getIcon();
   if (type == JCheckBoxMenuItem.class || type == JRadioButtonMenuItem.class) {
     AbstractButton b = (AbstractButton) c;
     if (b.isSelected()) {
       Part backgroundPart = Part.MP_POPUPCHECKBACKGROUND;
       Part part = Part.MP_POPUPCHECK;
       State backgroundState;
       State state;
       if (isEnabled(c, null)) {
         backgroundState = (icon != null) ? State.BITMAP : State.NORMAL;
         state =
             (type == JRadioButtonMenuItem.class) ? State.BULLETNORMAL : State.CHECKMARKNORMAL;
       } else {
         backgroundState = State.DISABLEDPUSHED;
         state =
             (type == JRadioButtonMenuItem.class)
                 ? State.BULLETDISABLED
                 : State.CHECKMARKDISABLED;
       }
       Skin skin;
       XPStyle xp = XPStyle.getXP();
       skin = xp.getSkin(c, backgroundPart);
       skin.paintSkin(g, x, y, getIconWidth(), getIconHeight(), backgroundState);
       if (icon == null) {
         skin = xp.getSkin(c, part);
         skin.paintSkin(g, x + OFFSET, y + OFFSET, state);
       }
     }
   }
   if (icon != null) {
     icon.paintIcon(c, g, x + OFFSET, y + OFFSET);
   }
 }
예제 #12
0
 protected void paintComponent(Graphics g)
 {
     if(skin != null)
     {
         int width = this.getWidth();
         int height = this.getHeight();
         Image image = skin.getPreviewImage();
         g.drawImage(image, 0, 0, width, height, this);
         image = null;
         
         if(mouseIn)
         {
             g.setColor(SHADOW_COLOR);
             g.fillRect(0, 0, width, height);
         }
         
         if(skin.isSelected())
         {
             g.setColor(SELECTED_COLOR);
             g.drawRect(0, 0, width - 1, height - 1);
         }
     }
 }
예제 #13
0
 /**
  * liefert einen lesbaren String mit allen Parametern des ausgelieferten Androiden
  *
  * @return ausgelieferter Androide
  */
 @Override
 public String toString() {
   return "("
       + seriennummer
       + ", "
       + androide.toString()
       + ", "
       + skin.toString()
       + ", "
       + software.toString()
       + ", "
       + aktorenKit.toString()
       + ")";
 }
 public Drawable createRightButtonDrawable(boolean emojiEnabled) {
   Drawable drawable =
       createSelectableDrawableWithPathFactory(
           new RightButtonPathFactory(
               skin.symbolMajorButtonPaddingDimension, skin.symbolMajorButtonRoundDimension));
   if (emojiEnabled) {
     return drawable;
   }
   return new LayerDrawable(
       new Drawable[] {
         drawable,
         new EmojiDisableIconDrawable(
             resources, skin.getDrawable(resources, R.raw.emoji_disable_icon)),
       });
 }
예제 #15
0
    static synchronized LContext startup(String string, String string_0_,
					 Container container, boolean bool) {
	LContext lcontext = new LContext();
	Logo.setupPrims(primclasses, lcontext);
	((LContext) lcontext).codeBase = string;
	((LContext) lcontext).projectURL = string_0_;
	((LContext) lcontext).autostart = bool;
	PlayerCanvas playercanvas = new PlayerCanvas();
	((PlayerCanvas) playercanvas).lc = lcontext;
	((LContext) lcontext).canvas = playercanvas;
	Skin.readSkin(playercanvas);
	SoundPlayer.startPlayer();
	container.add(playercanvas, "Center");
	LogoCommandRunner.startLogoThread("load \"startup startup", lcontext);
	return lcontext;
    }
예제 #16
0
  public void loadThread(String threadID, String threadName, String threadStatus) {
    try {
      PanelThreadMonitor mntTemp = new PanelThreadMonitor(channel);
      int iThreadStatus = Integer.parseInt(threadStatus);
      mntTemp.setThreadID(threadID);
      mntTemp.setThreadName(threadName);
      mntTemp.setThreadStatus(iThreadStatus);
      mntTemp.addPropertyChangeListener(this);

      pnlThread.add(threadName, mntTemp);
      mntTemp.updateStatus();
      Skin.applySkin(mntTemp);
    } catch (Exception e) {
      e.printStackTrace();
      MessageBox.showMessageDialog(this, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE);
    }
  }
예제 #17
0
  @SmallTest
  public void testDrawableCache() {
    Resources resources = createMock(MockResources.class);
    DrawableCache drawableCache = new DrawableCache(resources);
    drawableCache.setSkin(Skin.getFallbackInstance());

    // For invalid resource id (0), getDrawable returns {@code Optional.<Drawable>absent()} without
    // looking up resources.
    replayAll();

    assertFalse(drawableCache.getDrawable(0).isPresent());

    verifyAll();

    // For first getDrawable, it loads from resources instance.
    Drawable drawable = new ColorDrawable(Color.BLACK);
    resetAll();
    expect(resources.getResourceTypeName(1)).andReturn("drawable");
    expect(resources.getDrawable(1)).andReturn(drawable);
    replayAll();

    assertSame(drawable, drawableCache.getDrawable(1).get());

    verifyAll();

    // For second getDrawable (or later), it returns cached instance.
    resetAll();
    replayAll();

    assertSame(drawable, drawableCache.getDrawable(1).get());

    verifyAll();

    // Once clear is invoked, the drawable will be loaded from resources again.
    drawableCache.clear();
    resetAll();
    expect(resources.getResourceTypeName(1)).andReturn("drawable");
    expect(resources.getDrawable(1)).andReturn(drawable);
    replayAll();

    assertSame(drawable, drawableCache.getDrawable(1).get());

    verifyAll();
  }
예제 #18
0
파일: GUI.java 프로젝트: w4ll3/ppioo-1
  private static void loadLabels(Skin skin) {
    Label.LabelStyle labelStyle;

    for (ColorEnum color : LabelEnum.colors) {
      for (LabelEnum label : LabelEnum.values()) {
        labelStyle = new Label.LabelStyle();
        labelStyle.font = skin.getFont(label.fontName);
        labelStyle.fontColor = color.getColor();
        labelStyle.background = skin.getDrawable("transparent");
        if (LabelEnum.defaultColor == color) {
          skin.add(label.fontName, labelStyle);
        }
        skin.add(label.fontName + "." + color.colorName, labelStyle);
      }
    }

    skin.add("default", skin.get("default.black", LabelStyle.class));
  }
/** Factory to produce the buttons for SymbolMajorCategories. */
public class SymbolMajorCategoryButtonDrawableFactory {

  private interface PathFactory {
    Path newInstance(Rect bounds);
  }

  private static class LeftButtonPathFactory implements PathFactory {
    private final float padding;
    private final float round;

    // Padding is applied to left, top and bottom.
    // Right doesn't have padding in order to center left/right buttons.
    LeftButtonPathFactory(float padding, float round) {
      this.padding = padding;
      this.round = round;
    }

    @Override
    public Path newInstance(Rect bounds) {
      Preconditions.checkNotNull(bounds);
      float left = bounds.left + padding;
      float top = bounds.top + padding;
      float right = bounds.right - 2;
      float bottom = bounds.bottom - 1 - padding;

      Path path = new Path();
      path.moveTo(right, bottom);
      path.arcTo(new RectF(left, bottom - round * 2, left + round * 2, bottom), 90, 90);
      path.arcTo(new RectF(left, top, left + round + 2, top + round * 2), 180, 90);
      path.lineTo(right, top);
      path.close();

      return path;
    }
  }

  private static class CenterButtonPathFactory implements PathFactory {
    private final float padding;

    // Padding is applied only to top and bottom.
    CenterButtonPathFactory(float padding) {
      this.padding = padding;
    }

    @Override
    public Path newInstance(Rect bounds) {
      Preconditions.checkNotNull(bounds);
      float left = bounds.left;
      float top = bounds.top + padding;
      float right = bounds.right - 2;
      float bottom = bounds.bottom - 1 - padding;

      Path path = new Path();
      path.addRect(left, top, right, bottom, Direction.CW);
      return path;
    }
  }

  private static class RightButtonPathFactory implements PathFactory {
    private final float padding;
    private final float round;

    // Padding is applied to right, top and bottom.
    // Left doesn't have padding in order to center left/right buttons.
    RightButtonPathFactory(float padding, float round) {
      this.padding = padding;
      this.round = round;
    }

    @Override
    public Path newInstance(Rect bounds) {
      Preconditions.checkNotNull(bounds);
      float left = bounds.left;
      float top = bounds.top + padding;
      float right = bounds.right - 1 - padding;
      float bottom = bounds.bottom - 1 - padding;

      Path path = new Path();
      path.moveTo(left, top);
      path.arcTo(new RectF(right - round * 2, top, right, top + round * 2), 270, 90);
      path.arcTo(new RectF(right - round * 2, bottom - round * 2, right, bottom), 0, 90);
      path.lineTo(left, bottom);
      path.close();

      return path;
    }
  }

  private static class ButtonDrawable extends BaseBackgroundDrawable {

    private static final int BLUR_SIZE = 3;

    private final PathFactory pathFactory;
    private final int topColor;
    private final int bottomColor;

    private final Paint backgroundPaint = new Paint();
    private final Optional<Paint> shadowPaint;
    private Optional<Path> path = Optional.absent();

    ButtonDrawable(PathFactory pathFactory, int topColor, int bottomColor, int shadowColor) {
      super(0, 0, 0, 0); // No padding.
      this.pathFactory = Preconditions.checkNotNull(pathFactory);
      this.topColor = topColor;
      this.bottomColor = bottomColor;

      backgroundPaint.setAntiAlias(true);

      if (Color.alpha(shadowColor) != 0) {
        shadowPaint = Optional.of(new Paint());
        shadowPaint.get().setColor(shadowColor);
        shadowPaint.get().setStyle(Style.FILL);
        shadowPaint.get().setMaskFilter(new BlurMaskFilter(BLUR_SIZE, Blur.NORMAL));
      } else {
        shadowPaint = Optional.absent();
      }
    }

    @Override
    public void draw(Canvas canvas) {
      if (!path.isPresent()) {
        return;
      }

      if (shadowPaint.isPresent()) {
        int saveCount = canvas.save();
        try {
          canvas.translate(0, 2);
          canvas.drawPath(path.get(), shadowPaint.get());
        } finally {
          canvas.restoreToCount(saveCount);
        }
      }

      canvas.drawPath(path.get(), backgroundPaint);
    }

    @Override
    protected void onBoundsChange(Rect bounds) {
      super.onBoundsChange(bounds);

      if (isCanvasRectEmpty()) {
        path = Optional.absent();
        backgroundPaint.setShader(null);
        return;
      }

      path = Optional.of(pathFactory.newInstance(bounds));
      backgroundPaint.setShader(
          new LinearGradient(
              0, bounds.top, 0, bounds.bottom - 1, topColor, bottomColor, TileMode.CLAMP));
    }
  }

  private static class EmojiDisableIconDrawable extends BaseBackgroundDrawable {

    private final int size;
    private final Drawable sourceDrawable;

    EmojiDisableIconDrawable(Resources resources, Drawable sourceDrawable) {
      super(0, 0, 0, 0);
      size =
          Preconditions.checkNotNull(resources)
              .getDimensionPixelSize(R.dimen.symbol_major_emoji_disable_icon_height);
      sourceDrawable.setBounds(0, 0, size, size);
      this.sourceDrawable = Preconditions.checkNotNull(sourceDrawable);
    }

    @Override
    public void draw(Canvas canvas) {
      Rect bounds = getBounds();

      int saveCount = canvas.save();
      try {
        canvas.translate(bounds.right - size - 3, bounds.bottom - size - 3);
        canvas.clipRect(0, 0, size, size);
        sourceDrawable.draw(canvas);
      } finally {
        canvas.restoreToCount(saveCount);
      }
    }
  }

  private Skin skin = Skin.getFallbackInstance();

  private final Resources resources;

  public SymbolMajorCategoryButtonDrawableFactory(Resources resources) {
    this.resources = Preconditions.checkNotNull(resources);
  }

  public Drawable createLeftButtonDrawable() {
    return createSelectableDrawableWithPathFactory(
        new LeftButtonPathFactory(
            skin.symbolMajorButtonPaddingDimension, skin.symbolMajorButtonRoundDimension));
  }

  public Drawable createCenterButtonDrawable() {
    return createSelectableDrawableWithPathFactory(
        new CenterButtonPathFactory(skin.symbolMajorButtonPaddingDimension));
  }

  public Drawable createRightButtonDrawable(boolean emojiEnabled) {
    Drawable drawable =
        createSelectableDrawableWithPathFactory(
            new RightButtonPathFactory(
                skin.symbolMajorButtonPaddingDimension, skin.symbolMajorButtonRoundDimension));
    if (emojiEnabled) {
      return drawable;
    }
    return new LayerDrawable(
        new Drawable[] {
          drawable,
          new EmojiDisableIconDrawable(
              resources, skin.getDrawable(resources, R.raw.emoji_disable_icon)),
        });
  }

  private Drawable createSelectableDrawableWithPathFactory(PathFactory pathFactory) {
    return BackgroundDrawableFactory.createSelectableDrawable(
        new ButtonDrawable(
            pathFactory,
            skin.symbolMajorButtonSelectedTopColor,
            skin.symbolMajorButtonSelectedBottomColor,
            0),
        Optional.<Drawable>of(
            BackgroundDrawableFactory.createPressableDrawable(
                new ButtonDrawable(
                    pathFactory,
                    skin.symbolMajorButtonPressedTopColor,
                    skin.symbolMajorButtonPressedBottomColor,
                    0),
                Optional.<Drawable>of(
                    new ButtonDrawable(
                        pathFactory,
                        skin.symbolMajorButtonTopColor,
                        skin.symbolMajorButtonBottomColor,
                        skin.symbolMajorButtonShadowColor)))));
  }

  public void setSkin(Skin skin) {
    this.skin = Preconditions.checkNotNull(skin);
  }
}
예제 #20
0
 public TextField(String text, Skin skin, String styleName) {
   this(text, skin.get(styleName, TextFieldStyle.class));
 }
예제 #21
0
 private void jbInit() throws Exception {
   ////////////////////////////////////////////////////////
   // Init LAF
   ////////////////////////////////////////////////////////
   ButtonGroup grpLAF = new ButtonGroup();
   ActionListener lsnLAF =
       new ActionListener() {
         public void actionPerformed(ActionEvent evt) {
           int iIndex = mvtLAFItem.indexOf(evt.getSource());
           if (iIndex >= 0) changeLAF(iIndex);
         }
       };
   ////////////////////////////////////////////////////////
   UIManager.LookAndFeelInfo laf =
       new UIManager.LookAndFeelInfo(
           "Kunststoff", "com.incors.plaf.kunststoff.KunststoffLookAndFeel");
   marrLaf = UIManager.getInstalledLookAndFeels();
   int iIndex = 0;
   while (iIndex < marrLaf.length && !marrLaf[iIndex].getName().equals(laf.getName())) iIndex++;
   if (iIndex >= marrLaf.length) {
     UIManager.installLookAndFeel(laf);
     marrLaf = UIManager.getInstalledLookAndFeels();
   }
   for (iIndex = 0; iIndex < marrLaf.length; iIndex++) {
     JMenuItem mnu = new JRadioButtonMenuItem(marrLaf[iIndex].getName());
     mnu.addActionListener(lsnLAF);
     mvtLAFItem.addElement(mnu);
     mnuUI.add(mnu);
     grpLAF.add(mnu);
   }
   mnuUI.addSeparator();
   ////////////////////////////////////////////////////////
   // Init language
   ////////////////////////////////////////////////////////
   ButtonGroup grpLanguage = new ButtonGroup();
   ActionListener lsnLanguage =
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           int iIndex = mvtLanguageItem.indexOf(e.getSource());
           if (iIndex >= 0) changeDictionary((String) mvtLanguage.elementAt(iIndex));
         }
       };
   ////////////////////////////////////////////////////////
   String[] str = MonitorDictionary.getSupportedLanguage();
   for (iIndex = 0; iIndex < str.length; iIndex++) {
     JMenuItem mnu =
         new JRadioButtonMenuItem(MonitorDictionary.getDictionary(str[iIndex]).getLanguage());
     mnu.addActionListener(lsnLanguage);
     mvtLanguage.addElement(str[iIndex]);
     mvtLanguageItem.addElement(mnu);
     mnuUI.add(mnu);
     grpLanguage.add(mnu);
   }
   ////////////////////////////////////////////////////////
   // Add to main menu
   ////////////////////////////////////////////////////////
   mnuMain.removeAll();
   mnuMain.add(mnuSystem);
   mnuSystem.add(mnuSystem_Login);
   mnuSystem.add(mnuSystem_ChangePassword);
   mnuSystem.addSeparator();
   mnuSystem.add(mnuSystem_StopServer);
   mnuSystem.add(mnuSystem_EnableThreads);
   mnuMain.add(mnuUI);
   mnuMain.add(mnuHelp);
   mnuHelp.add(mnuHelp_About);
   ////////////////////////////////////////////////////////
   mnuMain.add(chkVietnamese);
   mnuMain.add(lblStatus);
   ////////////////////////////////////////////////////////
   pnlThread.setTabPlacement(JTabbedPane.LEFT);
   pnlThread.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
   ////////////////////////////////////////////////////////
   tblUser.addColumn("", 1, false);
   tblUser.addColumn("", 2, false, Global.FORMAT_DATE_TIME);
   tblUser.addColumn("", 3, false);
   ////////////////////////////////////////////////////////
   JPanel pnlMessage = new JPanel();
   pnlMessage.setLayout(new GridBagLayout());
   pnlMessage.add(
       new JScrollPane(txtBoard),
       new GridBagConstraints(
           0,
           0,
           2,
           1,
           1.0,
           1.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.BOTH,
           new Insets(2, 2, 2, 2),
           0,
           0));
   pnlMessage.add(
       txtMessage,
       new GridBagConstraints(
           0,
           1,
           1,
           1,
           1.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.BOTH,
           new Insets(2, 2, 2, 2),
           0,
           0));
   pnlMessage.add(
       btnSend,
       new GridBagConstraints(
           1,
           1,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(2, 2, 2, 2),
           0,
           0));
   txtBoard.setEditable(false);
   txtBoard.setAutoscrolls(true);
   txtBoard.setContentType("text/html");
   clearAll(txtBoard);
   ////////////////////////////////////////////////////////
   JPanel pnlUserButton = new JPanel(new GridLayout(1, 2, 4, 4));
   pnlUserButton.add(btnKick);
   pnlUserButton.add(btnRefresh);
   ////////////////////////////////////////////////////////
   JPanel pnlManager = new JPanel(new GridBagLayout());
   pnlManager.add(
       new JScrollPane(tblUser),
       new GridBagConstraints(
           0,
           0,
           1,
           1,
           1.0,
           1.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.BOTH,
           new Insets(2, 2, 2, 2),
           0,
           0));
   pnlManager.add(
       pnlUserButton,
       new GridBagConstraints(
           0,
           1,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(4, 2, 4, 2),
           0,
           0));
   ////////////////////////////////////////////////////////
   pnlUser.setDividerLocation(320);
   pnlUser.setLeftComponent(pnlManager);
   pnlUser.setRightComponent(pnlMessage);
   pnlUser.setOneTouchExpandable(true);
   ////////////////////////////////////////////////////////
   setOrientation(JSplitPane.VERTICAL_SPLIT);
   setOneTouchExpandable(true);
   pnlThread.setVisible(false);
   pnlUser.setVisible(false);
   setTopComponent(pnlThread);
   setBottomComponent(pnlUser);
   ////////////////////////////////////////////////////////
   pmn.add(mnuSelectAll);
   pmn.addSeparator();
   pmn.add(mnuClearSelected);
   pmn.add(mnuClearAll);
   ////////////////////////////////////////////////////////
   setBorder(BorderFactory.createEmptyBorder());
   pnlUser.setBorder(BorderFactory.createEmptyBorder());
   pnlManager.setBorder(
       BorderFactory.createBevelBorder(
           javax.swing.border.BevelBorder.RAISED,
           Color.white,
           UIManager.getColor("Panel.background"),
           UIManager.getColor("Panel.background"),
           UIManager.getColor("Panel.background")));
   pnlMessage.setBorder(
       BorderFactory.createBevelBorder(
           javax.swing.border.BevelBorder.RAISED,
           Color.white,
           UIManager.getColor("Panel.background"),
           UIManager.getColor("Panel.background"),
           UIManager.getColor("Panel.background")));
   ////////////////////////////////////////////////////////
   Skin.applySkin(mnuMain);
   Skin.applySkin(tblUser);
   Skin.applySkin(pmn);
   Skin.applySkin(this);
   ////////////////////////////////////////////////////////
   // Default setting
   ////////////////////////////////////////////////////////
   Hashtable prt = null;
   try {
     prt = Global.loadHashtable(Global.FILE_CONFIG);
   } catch (Exception e) {
     prt = new Hashtable();
   }
   changeLAF(Integer.parseInt(StringUtil.nvl(prt.get("LAF"), "0")));
   changeDictionary(StringUtil.nvl(prt.get("Language"), "VN"));
   Skin.LANGUAGE_CHANGE_LISTENER = this;
   MonitorProcessor.setRootObject(this);
   updateKeyboardUI();
   ////////////////////////////////////////////////////////
   // Event handler
   ////////////////////////////////////////////////////////
   tblUser.addMouseListener(
       new MouseAdapter() {
         public void mouseClicked(MouseEvent e) {
           if (e.getClickCount() > 1) btnKick.doClick();
         }
       });
   ////////////////////////////////////////////////////////
   btnRefresh.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent evt) {
           try {
             DDTP request = new DDTP();
             request.setRequestID(String.valueOf(System.currentTimeMillis()));
             DDTP response = channel.sendRequest("ThreadProcessor", "queryUserList", request);
             if (response != null) {
               tblUser.setData((Vector) response.getReturn());
               if (mstrChannel != null) removeUser(mstrChannel);
             }
           } catch (Exception e) {
             e.printStackTrace();
             MessageBox.showMessageDialog(pnlThread, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE);
           }
         }
       });
   ////////////////////////////////////////////////////////
   btnKick.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent evt) {
           int iSelected = tblUser.getSelectedRow();
           if (iSelected < 0) return;
           int iResult =
               MessageBox.showConfirmDialog(
                   pnlThread,
                   mdic.getString("ConfirmKick"),
                   Global.APP_NAME,
                   MessageBox.YES_NO_OPTION);
           if (iResult == MessageBox.NO_OPTION) return;
           try {
             String strChannel = (String) tblUser.getRow(iSelected).elementAt(0);
             DDTP request = new DDTP();
             request.setRequestID(String.valueOf(System.currentTimeMillis()));
             request.setString("strChannel", strChannel);
             DDTP response = channel.sendRequest("ThreadProcessor", "kickUser", request);
           } catch (Exception e) {
             e.printStackTrace();
             MessageBox.showMessageDialog(pnlThread, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE);
           }
         }
       });
   ////////////////////////////////////////////////////////
   txtMessage.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent evt) {
           btnSend.doClick();
         }
       });
   ////////////////////////////////////////////////////////
   btnSend.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent evt) {
           if (txtMessage.getText().length() == 0) return;
           try {
             DDTP request = new DDTP();
             request.setString("strMessage", txtMessage.getText());
             channel.sendRequest("ThreadProcessor", "sendMessage", request);
             txtMessage.setText("");
           } catch (Exception e) {
             e.printStackTrace();
             MessageBox.showMessageDialog(pnlThread, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE);
           }
         }
       });
   ////////////////////////////////////////////////////////
   mnuClearAll.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           clearAll(txtBoard);
         }
       });
   ////////////////////////////////////////////////////////
   mnuClearSelected.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           txtBoard.setEditable(true);
           txtBoard.replaceSelection("");
           txtBoard.setEditable(false);
         }
       });
   ////////////////////////////////////////////////////////
   mnuSelectAll.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           txtBoard.requestFocus();
           txtBoard.selectAll();
         }
       });
   ////////////////////////////////////////////////////////
   txtBoard.addMouseListener(
       new MouseAdapter() {
         public void mouseClicked(MouseEvent e) {
           if (e.getButton() == e.BUTTON3) pmn.show(txtBoard, e.getX(), e.getY());
         }
       });
   ////////////////////////////////////////////////////////
   mnuSystem_Login.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           login();
         }
       });
   ////////////////////////////////////////////////////////
   mnuSystem_ChangePassword.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           changePassword();
         }
       });
   ////////////////////////////////////////////////////////
   mnuSystem_StopServer.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           stopServer();
         }
       });
   ////////////////////////////////////////////////////////
   mnuSystem_EnableThreads.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           manageThreads();
         }
       });
   ////////////////////////////////////////////////////////
   mnuHelp_About.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           WindowManager.centeredWindow(new DialogAbout(PanelThreadManager.this));
         }
       });
   ////////////////////////////////////////////////////////
   chkVietnamese.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           switchKeyboard();
         }
       });
 }
예제 #22
0
    public void paintIcon(Component c, Graphics g, int x0, int y0) {
      int width = getIconWidth();
      int height = getIconHeight();

      XPStyle xp = XPStyle.getXP();
      if (xp != null) {
        Skin skin = xp.getSkin(c, part);
        AbstractButton b = (AbstractButton) c;
        ButtonModel model = b.getModel();

        // Find out if frame is inactive
        JInternalFrame jif =
            (JInternalFrame) SwingUtilities.getAncestorOfClass(JInternalFrame.class, b);
        boolean jifSelected = (jif != null && jif.isSelected());

        State state;
        if (jifSelected) {
          if (!model.isEnabled()) {
            state = State.DISABLED;
          } else if (model.isArmed() && model.isPressed()) {
            state = State.PUSHED;
          } else if (model.isRollover()) {
            state = State.HOT;
          } else {
            state = State.NORMAL;
          }
        } else {
          if (!model.isEnabled()) {
            state = State.INACTIVEDISABLED;
          } else if (model.isArmed() && model.isPressed()) {
            state = State.INACTIVEPUSHED;
          } else if (model.isRollover()) {
            state = State.INACTIVEHOT;
          } else {
            state = State.INACTIVENORMAL;
          }
        }
        skin.paintSkin(g, 0, 0, width, height, state);
      } else {
        g.setColor(Color.black);
        int x = width / 12 + 2;
        int y = height / 5;
        int h = height - y * 2 - 1;
        int w = width * 3 / 4 - 3;
        int thickness2 = Math.max(height / 8, 2);
        int thickness = Math.max(width / 15, 1);
        if (part == Part.WP_CLOSEBUTTON) {
          int lineWidth;
          if (width > 47) lineWidth = 6;
          else if (width > 37) lineWidth = 5;
          else if (width > 26) lineWidth = 4;
          else if (width > 16) lineWidth = 3;
          else if (width > 12) lineWidth = 2;
          else lineWidth = 1;
          y = height / 12 + 2;
          if (lineWidth == 1) {
            if (w % 2 == 1) {
              x++;
              w++;
            }
            g.drawLine(x, y, x + w - 2, y + w - 2);
            g.drawLine(x + w - 2, y, x, y + w - 2);
          } else if (lineWidth == 2) {
            if (w > 6) {
              x++;
              w--;
            }
            g.drawLine(x, y, x + w - 2, y + w - 2);
            g.drawLine(x + w - 2, y, x, y + w - 2);
            g.drawLine(x + 1, y, x + w - 1, y + w - 2);
            g.drawLine(x + w - 1, y, x + 1, y + w - 2);
          } else {
            x += 2;
            y++;
            w -= 2;
            g.drawLine(x, y, x + w - 1, y + w - 1);
            g.drawLine(x + w - 1, y, x, y + w - 1);
            g.drawLine(x + 1, y, x + w - 1, y + w - 2);
            g.drawLine(x + w - 2, y, x, y + w - 2);
            g.drawLine(x, y + 1, x + w - 2, y + w - 1);
            g.drawLine(x + w - 1, y + 1, x + 1, y + w - 1);
            for (int i = 4; i <= lineWidth; i++) {
              g.drawLine(x + i - 2, y, x + w - 1, y + w - i + 1);
              g.drawLine(x, y + i - 2, x + w - i + 1, y + w - 1);
              g.drawLine(x + w - i + 1, y, x, y + w - i + 1);
              g.drawLine(x + w - 1, y + i - 2, x + i - 2, y + w - 1);
            }
          }
        } else if (part == Part.WP_MINBUTTON) {
          g.fillRect(x, y + h - thickness2, w - w / 3, thickness2);
        } else if (part == Part.WP_MAXBUTTON) {
          g.fillRect(x, y, w, thickness2);
          g.fillRect(x, y, thickness, h);
          g.fillRect(x + w - thickness, y, thickness, h);
          g.fillRect(x, y + h - thickness, w, thickness);
        } else if (part == Part.WP_RESTOREBUTTON) {
          g.fillRect(x + w / 3, y, w - w / 3, thickness2);
          g.fillRect(x + w / 3, y, thickness, h / 3);
          g.fillRect(x + w - thickness, y, thickness, h - h / 3);
          g.fillRect(x + w - w / 3, y + h - h / 3 - thickness, w / 3, thickness);

          g.fillRect(x, y + h / 3, w - w / 3, thickness2);
          g.fillRect(x, y + h / 3, thickness, h - h / 3);
          g.fillRect(x + w - w / 3 - thickness, y + h / 3, thickness, h - h / 3);
          g.fillRect(x, y + h - thickness, w - w / 3, thickness);
        }
      }
    }
예제 #23
0
 public TextField(String text, Skin skin) {
   this(text, skin.get(TextFieldStyle.class));
 }
예제 #24
0
 public ToolChooser(@NtN Skin skin) {
   this.skin = skin;
   TextureAtlas.AtlasRegion toolsRegion = skin.getAtlas().findRegion("tools");
   int size = toolsRegion.getRegionHeight();
   regions = toolsRegion.split(size, size)[0];
 }
예제 #25
0
    public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
      if (!(c instanceof JToolBar)) {
        return;
      }
      g.translate(x, y);

      XPStyle xp = XPStyle.getXP();
      if (xp != null) {
        Border xpBorder = xp.getBorder(c, Part.TP_TOOLBAR);
        if (xpBorder != null) {
          xpBorder.paintBorder(c, g, 0, 0, width, height);
        }
      }
      if (((JToolBar) c).isFloatable()) {
        boolean vertical = ((JToolBar) c).getOrientation() == VERTICAL;

        if (xp != null) {
          Part part = vertical ? Part.RP_GRIPPERVERT : Part.RP_GRIPPER;
          Skin skin = xp.getSkin(c, part);
          int dx, dy, dw, dh;
          if (vertical) {
            dx = 0;
            dy = 2;
            dw = width - 1;
            dh = skin.getHeight();
          } else {
            dw = skin.getWidth();
            dh = height - 1;
            dx = c.getComponentOrientation().isLeftToRight() ? 2 : (width - dw - 2);
            dy = 0;
          }
          skin.paintSkin(g, dx, dy, dw, dh, State.NORMAL);

        } else {

          if (!vertical) {
            if (c.getComponentOrientation().isLeftToRight()) {
              g.setColor(shadow);
              g.drawLine(4, 3, 4, height - 4);
              g.drawLine(4, height - 4, 2, height - 4);

              g.setColor(highlight);
              g.drawLine(2, 3, 3, 3);
              g.drawLine(2, 3, 2, height - 5);
            } else {
              g.setColor(shadow);
              g.drawLine(width - 3, 3, width - 3, height - 4);
              g.drawLine(width - 4, height - 4, width - 4, height - 4);

              g.setColor(highlight);
              g.drawLine(width - 5, 3, width - 4, 3);
              g.drawLine(width - 5, 3, width - 5, height - 5);
            }
          } else { // Vertical
            g.setColor(shadow);
            g.drawLine(3, 4, width - 4, 4);
            g.drawLine(width - 4, 2, width - 4, 4);

            g.setColor(highlight);
            g.drawLine(3, 2, width - 4, 2);
            g.drawLine(3, 2, 3, 3);
          }
        }
      }

      g.translate(-x, -y);
    }
예제 #26
0
파일: ScrollPane.java 프로젝트: xYaW/libgdx
 /** @param widget May be null. */
 public ScrollPane(Actor widget, Skin skin, String styleName) {
   this(widget, skin.get(styleName, ScrollPaneStyle.class));
 }
예제 #27
0
파일: ScrollPane.java 프로젝트: xYaW/libgdx
 /** @param widget May be null. */
 public ScrollPane(Actor widget, Skin skin) {
   this(widget, skin.get(ScrollPaneStyle.class));
 }
예제 #28
0
    public void paintIcon(Component c, Graphics g, int x, int y) {
      AbstractButton b = (AbstractButton) c;
      ButtonModel model = b.getModel();
      XPStyle xp = XPStyle.getXP();

      if (xp != null) {
        Part part = Part.BP_RADIOBUTTON;
        Skin skin = xp.getSkin(b, part);
        State state;
        int index = 0;
        if (model.isSelected()) {
          state = State.CHECKEDNORMAL;
          if (!model.isEnabled()) {
            state = State.CHECKEDDISABLED;
          } else if (model.isPressed() && model.isArmed()) {
            state = State.CHECKEDPRESSED;
          } else if (model.isRollover()) {
            state = State.CHECKEDHOT;
          }
        } else {
          state = State.UNCHECKEDNORMAL;
          if (!model.isEnabled()) {
            state = State.UNCHECKEDDISABLED;
          } else if (model.isPressed() && model.isArmed()) {
            state = State.UNCHECKEDPRESSED;
          } else if (model.isRollover()) {
            state = State.UNCHECKEDHOT;
          }
        }
        skin.paintSkin(g, x, y, state);
      } else {
        // fill interior
        if ((model.isPressed() && model.isArmed()) || !model.isEnabled()) {
          g.setColor(UIManager.getColor("RadioButton.background"));
        } else {
          g.setColor(UIManager.getColor("RadioButton.interiorBackground"));
        }
        g.fillRect(x + 2, y + 2, 8, 8);

        // outter left arc
        g.setColor(UIManager.getColor("RadioButton.shadow"));
        g.drawLine(x + 4, y + 0, x + 7, y + 0);
        g.drawLine(x + 2, y + 1, x + 3, y + 1);
        g.drawLine(x + 8, y + 1, x + 9, y + 1);
        g.drawLine(x + 1, y + 2, x + 1, y + 3);
        g.drawLine(x + 0, y + 4, x + 0, y + 7);
        g.drawLine(x + 1, y + 8, x + 1, y + 9);

        // outter right arc
        g.setColor(UIManager.getColor("RadioButton.highlight"));
        g.drawLine(x + 2, y + 10, x + 3, y + 10);
        g.drawLine(x + 4, y + 11, x + 7, y + 11);
        g.drawLine(x + 8, y + 10, x + 9, y + 10);
        g.drawLine(x + 10, y + 9, x + 10, y + 8);
        g.drawLine(x + 11, y + 7, x + 11, y + 4);
        g.drawLine(x + 10, y + 3, x + 10, y + 2);

        // inner left arc
        g.setColor(UIManager.getColor("RadioButton.darkShadow"));
        g.drawLine(x + 4, y + 1, x + 7, y + 1);
        g.drawLine(x + 2, y + 2, x + 3, y + 2);
        g.drawLine(x + 8, y + 2, x + 9, y + 2);
        g.drawLine(x + 2, y + 3, x + 2, y + 3);
        g.drawLine(x + 1, y + 4, x + 1, y + 7);
        g.drawLine(x + 2, y + 8, x + 2, y + 8);

        // inner right arc
        g.setColor(UIManager.getColor("RadioButton.light"));
        g.drawLine(x + 2, y + 9, x + 3, y + 9);
        g.drawLine(x + 4, y + 10, x + 7, y + 10);
        g.drawLine(x + 8, y + 9, x + 9, y + 9);
        g.drawLine(x + 9, y + 8, x + 9, y + 8);
        g.drawLine(x + 10, y + 7, x + 10, y + 4);
        g.drawLine(x + 9, y + 3, x + 9, y + 3);

        // indicate whether selected or not
        if (model.isSelected()) {
          if (model.isEnabled()) {
            g.setColor(UIManager.getColor("RadioButton.foreground"));
          } else {
            g.setColor(UIManager.getColor("RadioButton.shadow"));
          }
          g.fillRect(x + 4, y + 5, 4, 2);
          g.fillRect(x + 5, y + 4, 2, 4);
        }
      }
    }
예제 #29
0
파일: GUI.java 프로젝트: w4ll3/ppioo-1
  public static void configureSkin(Skin skin) {
    if (skin == null) {
      return;
    }

    loadResources(skin);
    loadLabels(skin);
    loadButtons(skin);

    ScrollPane.ScrollPaneStyle scrollPaneStyle = new ScrollPane.ScrollPaneStyle();
    scrollPaneStyle.background = skin.newDrawable("white", Color.BLACK);
    scrollPaneStyle.hScroll = skin.newDrawable("white8x1", Color.GRAY);
    scrollPaneStyle.hScrollKnob = skin.newDrawable("white8x1", Color.WHITE);
    scrollPaneStyle.vScroll = skin.newDrawable("white1x8", Color.GRAY);
    scrollPaneStyle.vScrollKnob = skin.newDrawable("white1x8", Color.WHITE);
    scrollPaneStyle.corner = skin.newDrawable("white", Color.GRAY);
    skin.add("default", scrollPaneStyle);

    CheckBox.CheckBoxStyle checkBoxStyle = new CheckBox.CheckBoxStyle();
    checkBoxStyle.font = skin.getFont("default");
    checkBoxStyle.fontColor = Color.BLACK;
    checkBoxStyle.checkboxOn = skin.getDrawable("checkbox.on");
    checkBoxStyle.checkboxOnDisabled = skin.getDrawable("checkbox.on.disabled");
    checkBoxStyle.checkboxOff = skin.getDrawable("checkbox.off");
    checkBoxStyle.checkboxOffDisabled = skin.getDrawable("checkbox.off.disabled");
    skin.add("default", checkBoxStyle);

    checkBoxStyle = new CheckBox.CheckBoxStyle();
    checkBoxStyle.font = skin.getFont("default");
    checkBoxStyle.fontColor = Color.BLACK;
    checkBoxStyle.checkboxOn = skin.getDrawable("checkbox.on.slider.horizontal");
    // checkBoxStyle.checkboxOnDisabled = skin.getDrawable("checkbox.on.disabled");
    checkBoxStyle.checkboxOff = skin.getDrawable("checkbox.off.slider.horizontal");
    // checkBoxStyle.checkboxOffDisabled = skin.getDrawable("checkbox.off.disabled");
    skin.add("slider.horizontal", checkBoxStyle);

    Window.WindowStyle dialogStyle = new Window.WindowStyle();
    dialogStyle.background = skin.newDrawable("window");
    dialogStyle.stageBackground = skin.newDrawable("white", Color.valueOf("00000080"));
    dialogStyle.titleFont = skin.getFont("medium");
    dialogStyle.titleFontColor = Color.BLACK;
    skin.add("default", dialogStyle);

    ImageButton.ImageButtonStyle upButtonStyle = new ImageButton.ImageButtonStyle();
    upButtonStyle.imageUp = skin.getDrawable("arrow.up");
    upButtonStyle.imageDown = skin.getDrawable("arrow.up");
    upButtonStyle.imageDisabled = skin.getDrawable("arrow.up.disabled");
    skin.add("arrow.up", upButtonStyle);

    ImageButton.ImageButtonStyle downButtonStyle = new ImageButton.ImageButtonStyle();
    downButtonStyle.imageUp = skin.getDrawable("arrow.down");
    downButtonStyle.imageDown = skin.getDrawable("arrow.down");
    downButtonStyle.imageDisabled = skin.getDrawable("arrow.down.disabled");
    skin.add("arrow.down", downButtonStyle);

    ImageButton.ImageButtonStyle radioButtonStyle = new ImageButton.ImageButtonStyle();
    radioButtonStyle.imageUp = skin.getDrawable("radiobutton.off");
    radioButtonStyle.imageOver = skin.getDrawable("radiobutton.off.over");
    radioButtonStyle.imageChecked = skin.getDrawable("radiobutton.on");
    radioButtonStyle.imageCheckedOver = skin.getDrawable("radiobutton.on.over");
    radioButtonStyle.imageDisabled = skin.getDrawable("radiobutton.disabled");
    skin.add("radiobutton", radioButtonStyle);
  }
예제 #30
0
파일: GUI.java 프로젝트: w4ll3/ppioo-1
  private static void loadResources(Skin skin) {
    FreeTypeFontGenerator gen = new FreeTypeFontGenerator(Gdx.files.internal("graduate.ttf"));
    FreeTypeFontGenerator.FreeTypeFontParameter param =
        new FreeTypeFontGenerator.FreeTypeFontParameter();
    param.size = 12;
    skin.add("x-small", gen.generateFont(param));
    param.size = 16;
    skin.add("small", gen.generateFont(param));
    param.size = 20;
    skin.add("default", gen.generateFont(param));
    param.size = 24;
    skin.add("medium", gen.generateFont(param));
    param.size = 32;
    skin.add("big", gen.generateFont(param));
    param.size = 48;
    skin.add("huge", gen.generateFont(param));
    param.size = 72;
    skin.add("x-huge", gen.generateFont(param));

    skin.add(
        "default.up",
        new NinePatch(new Texture(Gdx.files.internal("button.up.default.9.png")), 16, 16, 16, 16));
    skin.add(
        "default.over",
        new NinePatch(
            new Texture(Gdx.files.internal("button.over.default.9.png")), 16, 16, 16, 16));
    skin.add(
        "default.down",
        new NinePatch(
            new Texture(Gdx.files.internal("button.down.default.9.png")), 16, 16, 16, 16));

    skin.add(
        "success.up",
        new NinePatch(new Texture(Gdx.files.internal("button.up.success.9.png")), 16, 16, 16, 16));
    skin.add(
        "success.over",
        new NinePatch(
            new Texture(Gdx.files.internal("button.over.success.9.png")), 16, 16, 16, 16));
    skin.add(
        "success.down",
        new NinePatch(
            new Texture(Gdx.files.internal("button.down.success.9.png")), 16, 16, 16, 16));

    skin.add(
        "warning.up",
        new NinePatch(new Texture(Gdx.files.internal("button.up.warning.9.png")), 16, 16, 16, 16));
    skin.add(
        "warning.over",
        new NinePatch(
            new Texture(Gdx.files.internal("button.over.warning.9.png")), 16, 16, 16, 16));
    skin.add(
        "warning.down",
        new NinePatch(
            new Texture(Gdx.files.internal("button.down.warning.9.png")), 16, 16, 16, 16));

    skin.add(
        "error.up",
        new NinePatch(new Texture(Gdx.files.internal("button.up.error.9.png")), 16, 16, 16, 16));
    skin.add(
        "error.over",
        new NinePatch(new Texture(Gdx.files.internal("button.over.error.9.png")), 16, 16, 16, 16));
    skin.add(
        "error.down",
        new NinePatch(new Texture(Gdx.files.internal("button.down.error.9.png")), 16, 16, 16, 16));

    skin.add(
        "window", new NinePatch(new Texture(Gdx.files.internal("window.9.png")), 32, 32, 32, 32));

    skin.add("checkbox.on", new Texture(Gdx.files.internal("checkbox.on.default.png")));
    skin.add("checkbox.off", new Texture(Gdx.files.internal("checkbox.off.default.png")));
    skin.add("checkbox.on.disabled", new Texture(Gdx.files.internal("checkbox.on.disabled.png")));
    skin.add("checkbox.off.disabled", new Texture(Gdx.files.internal("checkbox.off.disabled.png")));

    skin.add(
        "checkbox.on.slider.horizontal",
        new Texture(Gdx.files.internal("checkbox.on.slider.horizontal.png")));
    skin.add(
        "checkbox.off.slider.horizontal",
        new Texture(Gdx.files.internal("checkbox.off.slider.horizontal.png")));

    skin.add("radiobutton.on", new Texture(Gdx.files.internal("radiobutton.on.default.png")));
    skin.add(
        "radiobutton.on.over", new Texture(Gdx.files.internal("radiobutton.on.over.default.png")));
    skin.add("radiobutton.off", new Texture(Gdx.files.internal("radiobutton.off.default.png")));
    skin.add(
        "radiobutton.off.over",
        new Texture(Gdx.files.internal("radiobutton.off.over.default.png")));
    skin.add(
        "radiobutton.disabled",
        new Texture(Gdx.files.internal("radiobutton.disabled.default.png")));

    skin.add("arrow.up", new Texture(Gdx.files.internal("arrow.up.default.png")));
    skin.add("arrow.up.disabled", new Texture(Gdx.files.internal("arrow.up.disabled.png")));
    skin.add("arrow.down", new Texture(Gdx.files.internal("arrow.down.default.png")));
    skin.add("arrow.down.disabled", new Texture(Gdx.files.internal("arrow.down.disabled.png")));
    skin.add("arrow.left", new Texture(Gdx.files.internal("arrow.left.default.png")));
    skin.add("arrow.left.disabled", new Texture(Gdx.files.internal("arrow.left.disabled.png")));
    skin.add("arrow.right", new Texture(Gdx.files.internal("arrow.right.default.png")));
    skin.add("arrow.right.disabled", new Texture(Gdx.files.internal("arrow.right.disabled.png")));

    for (ColorEnum color : ColorEnum.values()) {
      skin.add(color.colorName, color.getColor());
    }

    Pixmap pixmap;

    pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
    pixmap.setColor(skin.getColor("white"));
    pixmap.fill();
    skin.add("white", new Texture(pixmap));

    pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
    pixmap.setColor(skin.getColor("transparent"));
    pixmap.fill();
    skin.add("transparent", new Texture(pixmap));

    pixmap = new Pixmap(8, 1, Pixmap.Format.RGBA8888);
    pixmap.setColor(Color.WHITE);
    pixmap.fill();
    skin.add("white1x8", new Texture(pixmap));

    pixmap = new Pixmap(1, 8, Pixmap.Format.RGBA8888);
    pixmap.setColor(Color.WHITE);
    pixmap.fill();
    skin.add("white8x1", new Texture(pixmap));

    pixmap = new Pixmap(32, 32, Pixmap.Format.RGBA8888);
    pixmap.setColor(Color.WHITE);
    pixmap.fill();
    skin.add("white32s", new Texture(pixmap));
  }