コード例 #1
0
 private JRadioButton getShapeButton(
     JRadioButton button, int x, int y, int w, int h, String tip, Shp shp, Obj obj) {
   button.setBounds(new Rectangle(x, y, w, h));
   button.setBorder(BorderFactory.createLoweredBevelBorder());
   button.setToolTipText(Messages.getString(tip));
   button.addActionListener(alShape);
   shapeButtons.add(button);
   shapes.put(shp, button);
   objects.put(shp, obj);
   return button;
 }
コード例 #2
0
ファイル: PrintResults.java プロジェクト: furyofdragon/jmdw
  void printResultsToHtml() {
    try {
      PrintWriter pw = new PrintWriter("jmdw_results.html");

      pw.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//RU\">");
      pw.println("<HTML><BODY>");
      // pw.println("<formula notation=’TeX’>E=mc^2</formula>");
      pw.println("<TABLE border=1 cellSpacing=0 cellPadding=0 width=100%><TBODY>");
      pw.println(
          "<TR><TD align=\"center\" colspan=\"2\"><B>"
              + Messages.getString("jmdw_main.InputData.text")
              + "</B></TD></TR>");
      pw.print("<TR><TD>" + Messages.getString("jmdw_main.grpShipsClass.text") + "</TD><TD>");
      int sclass = jmdw_main.ship.getsclass();
      switch (sclass) {
        case 1:
          pw.print(Messages.getString("jmdw_main.button_M.text"));
          break;
        case 2:
          pw.print(Messages.getString("jmdw_main.button_O.text"));
          break;
        case 3:
          pw.print(Messages.getString("jmdw_main.button_R.text"));
          break;
        case 4:
          pw.print(Messages.getString("jmdw_main.button_L.text"));
          break;
        case 5:
          pw.print(Messages.getString("jmdw_main.button_MSP.text"));
          break;
        case 6:
          pw.print(Messages.getString("jmdw_main.button_MPR.text"));
          break;
        case 7:
          pw.print(Messages.getString("jmdw_main.button_OPR.text"));
          break;
      }
      pw.println("</TD></TR>");
      if ((sclass == 1) | (sclass == 2) | (sclass == 3) | (sclass == 4)) { // river ship
        pw.print("<TR><TD>" + Messages.getString("jmdw_main.grpShipsType.text") + "</TD><TD>");
        int stype = jmdw_main.ship.getstype();
        switch (stype) {
          case 1:
            pw.print(Messages.getString("jmdw_main.btnCargoShip.text"));
            break;
          case 2:
            pw.print(Messages.getString("jmdw_main.btnPassangerShip.text"));
            break;
          case 3:
            pw.print(Messages.getString("jmdw_main.btnTowingShip.text"));
            break;
        }
        pw.println("</TD></TR>");
      }
      pw.println(
          "<TR><TD>"
              + Messages.getString("jmdw_main.lblLM.text")
              + "</TD><TD>"
              + Double.toString(jmdw_main.ship.getL())
              + "</TD></TR>");
      pw.println(
          "<TR><TD>"
              + Messages.getString("jmdw_main.lblBM.text")
              + "</TD><TD>"
              + Double.toString(jmdw_main.ship.getB())
              + "</TD></TR>");
      pw.println(
          "<TR><TD>"
              + Messages.getString("jmdw_main.lblTM.text")
              + "</TD><TD>"
              + Double.toString(jmdw_main.ship.getT())
              + "</TD></TR>");
      pw.println(
          "<TR><TD>"
              + Messages.getString("jmdw_main.lblTfM.text")
              + "</TD><TD>"
              + Double.toString(jmdw_main.ship.getTf())
              + "</TD></TR>");
      pw.println(
          "<TR><TD>"
              + Messages.getString("jmdw_main.label.text")
              + "</TD><TD>"
              + Double.toString(jmdw_main.ship.getdelta())
              + "</TD></TR>");
      pw.println(
          "<TR><TD>"
              + Messages.getString("jmdw_main.lblShipsSpeedKmh.text")
              + "</TD><TD>"
              + Double.toString(jmdw_main.ship.getSpeed())
              + "</TD></TR>");
      pw.println(
          "<TR><TD>"
              + Messages.getString("jmdw_main.lblMomentOfInertia.text")
              + "</TD><TD>"
              + Double.toString(jmdw_main.ship.getI())
              + "</TD></TR>");
      pw.println(
          "<TR><TD>"
              + Messages.getString("jmdw_main.lblHeightOfWaves.text")
              + "</TD><TD>"
              + Double.toString(jmdw_main.ship.geth())
              + "</TD></TR>");
      pw.println(
          "<TR><TD align=\"center\" colspan=\"2\"><B>"
              + Messages.getString("jmdw_main.Results.text")
              + "</B></TD></TR>");
      if ((sclass == 1) | (sclass == 2) | (sclass == 3) | (sclass == 4)) { // river ship
        pw.println(
            "<TR><TD>"
                + "ε"
                + "</TD><TD>"
                + Double.toString(jmdw_main.ship.get_eps())
                + "</TD></TR>");
        pw.println(
            "<TR><TD>"
                + "η"
                + "</TD><TD>"
                + Double.toString(jmdw_main.ship.get_eta())
                + "</TD></TR>");
        pw.println(
            "<TR><TD>"
                + "kδ"
                + "</TD><TD>"
                + Double.toString(jmdw_main.ship.get_kd())
                + "</TD></TR>");
        pw.println(
            "<TR><TD>"
                + "kT"
                + "</TD><TD>"
                + Double.toString(jmdw_main.ship.get_kt())
                + "</TD></TR>");
        pw.println(
            "<TR><TD>"
                + "kB"
                + "</TD><TD>"
                + Double.toString(jmdw_main.ship.get_kb())
                + "</TD></TR>");
        pw.println(
            "<TR><TD><B>"
                + Messages.getString("jmdw_main.lblMv.text")
                + "</B></TD><TD><B>"
                + Double.toString(jmdw_main.ship.getMv())
                + "</B></TD></TR>");
        pw.println(
            "<TR><TD>"
                + "ωcp"
                + "</TD><TD>"
                + Double.toString(jmdw_main.ship.get_omsr())
                + "</TD></TR>");
        pw.println(
            "<TR><TD>"
                + "kv"
                + "</TD><TD>"
                + Double.toString(jmdw_main.ship.get_kv())
                + "</TD></TR>");
        pw.println(
            "<TR><TD>"
                + "ωk"
                + "</TD><TD>"
                + Double.toString(jmdw_main.ship.get_omk())
                + "</TD></TR>");
        pw.println(
            "<TR><TD>"
                + "ks"
                + "</TD><TD>"
                + Double.toString(jmdw_main.ship.get_ks())
                + "</TD></TR>");
        pw.println(
            "<TR><TD>"
                + "σ"
                + "</TD><TD>"
                + Double.toString(jmdw_main.ship.get_sigma())
                + "</TD></TR>");
        pw.println(
            "<TR><TD>"
                + "kμ"
                + "</TD><TD>"
                + Double.toString(jmdw_main.ship.get_kmu())
                + "</TD></TR>");
        pw.println(
            "<TR><TD><B>"
                + Messages.getString("jmdw_main.lblKp.text")
                + "</B></TD><TD><B>"
                + Double.toString(jmdw_main.ship.getkp())
                + "</B></TD></TR>");
        pw.println(
            "<TR><TD>"
                + "b0"
                + "</TD><TD>"
                + Double.toString(jmdw_main.ship.get_b0())
                + "</TD></TR>");
        pw.println(
            "<TR><TD>"
                + "φ0"
                + "</TD><TD>"
                + Double.toString(jmdw_main.ship.get_fi0())
                + "</TD></TR>");
        pw.println(
            "<TR><TD>"
                + "v1"
                + "</TD><TD>"
                + Double.toString(jmdw_main.ship.get_v1())
                + "</TD></TR>");
        pw.println(
            "<TR><TD>"
                + "v0"
                + "</TD><TD>"
                + Double.toString(jmdw_main.ship.get_v0())
                + "</TD></TR>");
        pw.println(
            "<TR><TD>"
                + "ky"
                + "</TD><TD>"
                + Double.toString(jmdw_main.ship.get_ky())
                + "</TD></TR>");
        pw.println(
            "<TR><TD>"
                + "Tp"
                + "</TD><TD>"
                + Double.toString(jmdw_main.ship.get_Tp())
                + "</TD></TR>");
        pw.println(
            "<TR><TD>"
                + "φ1"
                + "</TD><TD>"
                + Double.toString(jmdw_main.ship.get_fi1())
                + "</TD></TR>");
        pw.println(
            "<TR><TD><B>"
                + Messages.getString("jmdw_main.lblMy.text")
                + "</B></TD><TD><B>"
                + Double.toString(jmdw_main.ship.getMy())
                + "</B></TD></TR>");
      } else { // 5, 6 or 7 - coastal
        pw.println("<TR><TD>k0</TD><TD>" + Double.toString(jmdw_main.ship.getk0()) + "</TD></TR>");
        pw.println("<TR><TD>k1</TD><TD>" + Double.toString(jmdw_main.ship.getk1()) + "</TD></TR>");
        pw.println("<TR><TD>k2</TD><TD>" + Double.toString(jmdw_main.ship.getk2()) + "</TD></TR>");
        pw.println("<TR><TD>k3</TD><TD>" + Double.toString(jmdw_main.ship.getk3()) + "</TD></TR>");
      }
      pw.println(
          "<TR><TD><B>"
              + Messages.getString("jmdw_main.lblMdw.text")
              + "</B></TD><TD><B>"
              + Double.toString(jmdw_main.ship.getMdw())
              + "</B></TD></TR>");

      pw.println("</TBODY></TABLE>");
      pw.println("</BODY></HTML>");

      pw.close();

    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
コード例 #3
0
ファイル: PanelSpec.java プロジェクト: ncrystal/josm-plugins
  public PanelSpec(SmedAction dia) {
    dlg = dia;
    setLayout(null);
    add(getShapeButton(pillarButton, 0, 0, 34, 32, "Pillar", Shp.PILLAR, Obj.BOYSPP));
    add(getShapeButton(sparButton, 34, 0, 34, 32, "Spar", Shp.SPAR, Obj.BOYSPP));
    add(getShapeButton(canButton, 68, 0, 34, 32, "Can", Shp.CAN, Obj.BOYSPP));
    add(getShapeButton(coneButton, 102, 0, 34, 32, "Cone", Shp.CONI, Obj.BOYSPP));
    add(getShapeButton(sphereButton, 0, 32, 34, 32, "Sphere", Shp.SPHERI, Obj.BOYSPP));
    add(getShapeButton(barrelButton, 34, 32, 34, 32, "Barrel", Shp.BARREL, Obj.BOYSPP));
    add(getShapeButton(superButton, 68, 32, 34, 32, "Super", Shp.SUPER, Obj.BOYSPP));
    add(getShapeButton(floatButton, 102, 32, 34, 32, "Float", Shp.FLOAT, Obj.LITFLT));
    add(getShapeButton(beaconButton, 0, 64, 34, 32, "Beacon", Shp.BEACON, Obj.BCNSPP));
    add(getShapeButton(towerButton, 34, 64, 34, 32, "TowerB", Shp.TOWER, Obj.BCNSPP));
    add(getShapeButton(stakeButton, 68, 64, 34, 32, "Stake", Shp.STAKE, Obj.BCNSPP));
    add(getShapeButton(cairnButton, 102, 64, 34, 32, "CairnB", Shp.CAIRN, Obj.BCNSPP));

    categoryLabel = new JLabel(Messages.getString("Category"), SwingConstants.CENTER);
    categoryLabel.setBounds(new Rectangle(5, 125, 160, 18));
    add(categoryLabel);
    categoryBox = new JComboBox();
    categoryBox.setBounds(new Rectangle(5, 142, 160, 18));
    add(categoryBox);
    categoryBox.setVisible(true);
    categoryBox.addActionListener(alCategoryBox);
    addCatItem("", Cat.NOCAT);
    addCatItem(Messages.getString("UKPurpose"), Cat.SPM_UNKN);
    addCatItem(Messages.getString("Warning"), Cat.SPM_WARN);
    addCatItem(Messages.getString("ChanSeparation"), Cat.SPM_CHBF);
    addCatItem(Messages.getString("Yachting"), Cat.SPM_YCHT);
    addCatItem(Messages.getString("Cable"), Cat.SPM_CABL);
    addCatItem(Messages.getString("Outfall"), Cat.SPM_OFAL);
    addCatItem(Messages.getString("ODAS"), Cat.SPM_ODAS);
    addCatItem(Messages.getString("RecreationZone"), Cat.SPM_RECN);
    addCatItem(Messages.getString("Mooring"), Cat.SPM_MOOR);
    addCatItem(Messages.getString("LANBY"), Cat.SPM_LNBY);
    addCatItem(Messages.getString("Leading"), Cat.SPM_LDNG);
    addCatItem(Messages.getString("Notice"), Cat.SPM_NOTC);
    addCatItem(Messages.getString("TSS"), Cat.SPM_TSS);
    addCatItem(Messages.getString("FoulGround"), Cat.SPM_FOUL);
    addCatItem(Messages.getString("Diving"), Cat.SPM_DIVE);
    addCatItem(Messages.getString("FerryCross"), Cat.SPM_FRRY);
    addCatItem(Messages.getString("Anchorage"), Cat.SPM_ANCH);
    mooringBox = new JComboBox();
    mooringBox.setBounds(new Rectangle(5, 142, 160, 18));
    add(mooringBox);
    mooringBox.setVisible(false);
    mooringBox.addActionListener(alMooringBox);
    addMorItem("", Cat.NOCAT);
    addMorItem(Messages.getString("Dolphin"), Cat.MOR_DLPN);
    addMorItem(Messages.getString("DevDolphin"), Cat.MOR_DDPN);
    addMorItem(Messages.getString("Bollard"), Cat.MOR_BLRD);
    addMorItem(Messages.getString("Wall"), Cat.MOR_WALL);
    addMorItem(Messages.getString("Post"), Cat.MOR_POST);
    addMorItem(Messages.getString("Chain"), Cat.MOR_CHWR);
    addMorItem(Messages.getString("Rope"), Cat.MOR_ROPE);
    addMorItem(Messages.getString("Automatic"), Cat.MOR_AUTO);
    addMorItem(Messages.getString("MooringBuoy"), Cat.MOR_BUOY);
    addMorItem(Messages.getString("CALM"), Cat.INB_CALM);
    addMorItem(Messages.getString("SBM"), Cat.INB_SBM);

    topmarkButton.setBounds(new Rectangle(136, 0, 34, 32));
    topmarkButton.setToolTipText(Messages.getString("Topmark"));
    topmarkButton.setBorder(BorderFactory.createLoweredBevelBorder());
    topmarkButton.addActionListener(alTop);
    add(topmarkButton);

    //		noticeButton.setBounds(new Rectangle(136, 32, 34, 32));
    //		noticeButton.setToolTipText(Messages.getString("Notice"));
    //		noticeButton.setBorder(BorderFactory.createLoweredBevelBorder());
    //		noticeButton.addActionListener(alNotice);
    //		add(noticeButton);

    mooringButton.setBounds(new Rectangle(136, 64, 34, 32));
    mooringButton.setToolTipText(Messages.getString("Mooring"));
    mooringButton.setBorder(BorderFactory.createLoweredBevelBorder());
    mooringButton.addActionListener(alMooring);
    add(mooringButton);
  }