public ControlPanel_Fonts() {
    initComponents();

    font.setText(LocalSettings.getProperty(LocalSettings.DEFAULT_FONT));
    jFontChooser1.setSelectedFont(
        Font.decode(LocalSettings.getProperty(LocalSettings.DEFAULT_FONT)));

    validate();
  }
示例#2
0
  /**
   * Starts the server
   *
   * @throws Exception
   */
  public XMLRPCServer() throws Exception {
    if (LocalSettings.hasProperty(LocalSettings.SERVER_PORT)) {
      port = Integer.valueOf(LocalSettings.getProperty(LocalSettings.SERVER_PORT));
    }
    webServer = new WebServer(getPort());
    XmlRpcServer xmlRpcServer = webServer.getXmlRpcServer();
    ((XmlRpcStreamServer) xmlRpcServer)
        .setErrorLogger(
            new XmlRpcErrorLogger() {

              @Override
              public void log(java.lang.String pMessage) {
                Log.Debug(this, pMessage);
              }

              @Override
              public void log(java.lang.String pMessage, java.lang.Throwable pThrowable) {
                Log.Debug(this, pMessage);
                Log.Debug(pThrowable);
              }
            });

    PropertyHandlerMapping phm = new XPropertyHandlerMapping();
    //        ArrayList<Context> cx = Context.getImportableContexts();
    //        for (int i = 0; i < cx.size(); i++) {
    //            Context context = cx.get(i);
    //        }
    phm.addHandler("remote", XMLRPCHandler.class);

    xmlRpcServer.setHandlerMapping(phm);

    XmlRpcServerConfigImpl serverConfig = (XmlRpcServerConfigImpl) xmlRpcServer.getConfig();
    serverConfig.setEnabledForExtensions(true);
    serverConfig.setContentLengthOptional(false);

    PropertyHandlerMapping mapping =
        (PropertyHandlerMapping) ((XmlRpcStreamServer) xmlRpcServer).getHandlerMapping();
    XmlRpcSystemImpl.addSystemHandler(mapping);

    webServer.start();
    Log.Debug(this, "XML RPC Server started! Listening port: " + port);

    if (Log.getLoglevel() == Log.LOGLEVEL_DEBUG) {
      Log.Debug(this, "XML RPC Server handler: ");
      String[] lm = phm.getListMethods();
      for (int i = 0; i < lm.length; i++) {
        String string = lm[i];
        Log.Debug(this, string);
      }
    }
  }
  private void setSettings() {

    if (font.getText().equalsIgnoreCase(getFontString(Font.decode(null)))) {
      LocalSettings.setProperty(
          LocalSettings.DEFAULT_FONT, getFontString(jFontChooser1.getSelectedFont()));

    } else if (font.getText() != null
        && font.getText().length() > 0
        && !(getFontString(font.getText())).equalsIgnoreCase(getFontString(Font.decode(null)))) {
      LocalSettings.setProperty(LocalSettings.DEFAULT_FONT, getFontString(font.getText()));

    } else {
      Popup.notice(Messages.VALUE_NOT_VALID + font.getText());
    }

    jFontChooser1.setSelectedFont(
        Font.decode(LocalSettings.getProperty(LocalSettings.DEFAULT_FONT)));
    font.setText(getFontString(jFontChooser1.getSelectedFont()));

    applyFont(Font.decode(getFontString(font.getText())));
  }
示例#4
0
  /**
   * This method is called from within the constructor to initialize the form. WARNING: Do NOT
   * modify this code. The content of this method is always regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    jPanel1 = new javax.swing.JPanel();
    jTextField1 = new javax.swing.JTextField();
    jPanel2 = new javax.swing.JPanel();
    jButton9 = new javax.swing.JButton();
    jButton5 = new javax.swing.JButton();
    jButton1 = new javax.swing.JButton();
    jButton13 = new javax.swing.JButton();
    jButton14 = new javax.swing.JButton();
    jButton10 = new javax.swing.JButton();
    jButton6 = new javax.swing.JButton();
    jButton2 = new javax.swing.JButton();
    jButton3 = new javax.swing.JButton();
    jButton7 = new javax.swing.JButton();
    jButton11 = new javax.swing.JButton();
    jButton15 = new javax.swing.JButton();
    jButton16 = new javax.swing.JButton();
    jButton12 = new javax.swing.JButton();
    jButton8 = new javax.swing.JButton();
    jButton4 = new javax.swing.JButton();
    jButton17 = new javax.swing.JButton();
    jLabel1 = new javax.swing.JLabel();

    setTitle("MPCalculator");
    setResizable(false);

    jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Calculator"));

    jTextField1.setFont(
        new java.awt.Font(LocalSettings.getProperty("defaultfont"), 0, 18)); // NOI18N
    jTextField1.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
    jTextField1.setText("0");

    // $2java.awt.Color(204, 204, 204));
    jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());

    jButton9.setFont(new java.awt.Font(LocalSettings.getProperty("defaultfont"), 1, 14)); // NOI18N
    jButton9.setText("7");

    jButton5.setFont(new java.awt.Font(LocalSettings.getProperty("defaultfont"), 1, 14)); // NOI18N
    jButton5.setText("4");

    jButton1.setFont(new java.awt.Font(LocalSettings.getProperty("defaultfont"), 1, 14)); // NOI18N
    jButton1.setText("1");

    jButton13.setFont(new java.awt.Font(LocalSettings.getProperty("defaultfont"), 1, 14)); // NOI18N
    jButton13.setText("0");

    jButton14.setFont(new java.awt.Font(LocalSettings.getProperty("defaultfont"), 1, 14)); // NOI18N
    jButton14.setText(".");

    jButton10.setFont(new java.awt.Font(LocalSettings.getProperty("defaultfont"), 1, 14)); // NOI18N
    jButton10.setText("8");

    jButton6.setFont(new java.awt.Font(LocalSettings.getProperty("defaultfont"), 1, 14)); // NOI18N
    jButton6.setText("5");

    jButton2.setFont(new java.awt.Font(LocalSettings.getProperty("defaultfont"), 1, 14)); // NOI18N
    jButton2.setText("2");

    jButton3.setFont(new java.awt.Font(LocalSettings.getProperty("defaultfont"), 1, 14)); // NOI18N
    jButton3.setText("3");

    jButton7.setFont(new java.awt.Font(LocalSettings.getProperty("defaultfont"), 1, 14)); // NOI18N
    jButton7.setText("6");

    jButton11.setFont(new java.awt.Font(LocalSettings.getProperty("defaultfont"), 1, 14)); // NOI18N
    jButton11.setText("9");

    jButton15.setFont(new java.awt.Font(LocalSettings.getProperty("defaultfont"), 1, 14)); // NOI18N
    jButton15.setText("=");

    jButton16.setFont(new java.awt.Font(LocalSettings.getProperty("defaultfont"), 1, 14)); // NOI18N
    jButton16.setText("+");

    jButton12.setFont(new java.awt.Font(LocalSettings.getProperty("defaultfont"), 1, 14)); // NOI18N
    jButton12.setText("-");

    jButton8.setFont(new java.awt.Font(LocalSettings.getProperty("defaultfont"), 1, 14)); // NOI18N
    jButton8.setText("*");

    jButton4.setFont(new java.awt.Font(LocalSettings.getProperty("defaultfont"), 1, 14)); // NOI18N
    jButton4.setText("/");

    javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout.setHorizontalGroup(
        jPanel2Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jPanel2Layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        jPanel2Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                jPanel2Layout
                                    .createSequentialGroup()
                                    .addComponent(
                                        jButton1,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        60,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        jButton2,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        60,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        jButton3,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        60,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        jButton4,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        60,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(
                                jPanel2Layout
                                    .createSequentialGroup()
                                    .addComponent(
                                        jButton5,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        60,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        jButton6,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        60,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        jButton7,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        60,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        jButton8,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        60,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(
                                jPanel2Layout
                                    .createSequentialGroup()
                                    .addComponent(
                                        jButton9,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        60,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        jButton10,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        60,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        jButton11,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        60,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        jButton12,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        60,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(
                                jPanel2Layout
                                    .createSequentialGroup()
                                    .addComponent(
                                        jButton13,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        60,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        jButton14,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        60,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        jButton15,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        60,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(
                                        jButton16,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        60,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap()));
    jPanel2Layout.setVerticalGroup(
        jPanel2Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jPanel2Layout
                    .createSequentialGroup()
                    .addContainerGap()
                    .addGroup(
                        jPanel2Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(
                                jButton1,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                35,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                jButton2,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                35,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                jButton3,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                35,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                jButton4,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                35,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(
                        jPanel2Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(
                                jButton5,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                35,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                jButton6,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                35,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                jButton7,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                35,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                jButton8,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                35,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(
                        jPanel2Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(
                                jButton9,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                35,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                jButton10,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                35,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                jButton11,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                35,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                jButton12,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                35,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(
                        jPanel2Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(
                                jButton14,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                35,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                jButton15,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                35,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                jButton16,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                35,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(
                                jButton13,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                35,
                                javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));

    jButton17.setText("Clear");

    jLabel1.setFont(new java.awt.Font(LocalSettings.getProperty("defaultfont"), 0, 14)); // NOI18N
    jLabel1.setForeground(new java.awt.Color(102, 102, 102));
    jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
        jPanel1Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jPanel1Layout
                    .createSequentialGroup()
                    .addGroup(
                        jPanel1Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(
                                javax.swing.GroupLayout.Alignment.LEADING,
                                jPanel1Layout
                                    .createSequentialGroup()
                                    .addComponent(jButton17)
                                    .addPreferredGap(
                                        javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                        191,
                                        Short.MAX_VALUE)
                                    .addComponent(
                                        jLabel1,
                                        javax.swing.GroupLayout.PREFERRED_SIZE,
                                        32,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(
                                jTextField1,
                                javax.swing.GroupLayout.Alignment.LEADING,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                282,
                                Short.MAX_VALUE)
                            .addComponent(
                                jPanel2,
                                javax.swing.GroupLayout.Alignment.LEADING,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                javax.swing.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE))
                    .addContainerGap()));
    jPanel1Layout.setVerticalGroup(
        jPanel1Layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                jPanel1Layout
                    .createSequentialGroup()
                    .addComponent(
                        jTextField1,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        33,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(
                        jPanel2,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(
                        javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                        javax.swing.GroupLayout.DEFAULT_SIZE,
                        Short.MAX_VALUE)
                    .addGroup(
                        jPanel1Layout
                            .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jButton17)
                            .addComponent(
                                jLabel1,
                                javax.swing.GroupLayout.PREFERRED_SIZE,
                                23,
                                javax.swing.GroupLayout.PREFERRED_SIZE))));

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(
                layout
                    .createSequentialGroup()
                    .addComponent(
                        jPanel1,
                        javax.swing.GroupLayout.PREFERRED_SIZE,
                        294,
                        javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, 0)));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(
                jPanel1,
                javax.swing.GroupLayout.PREFERRED_SIZE,
                javax.swing.GroupLayout.DEFAULT_SIZE,
                javax.swing.GroupLayout.PREFERRED_SIZE));

    pack();
  } // </editor-fold>//GEN-END:initComponents