コード例 #1
0
  public static void main(String args[]) {

    IntensityFeatureScaleSpacePyramidApp<ImageFloat32, ImageFloat32> app =
        new IntensityFeatureScaleSpacePyramidApp<ImageFloat32, ImageFloat32>(
            ImageFloat32.class, ImageFloat32.class);

    //		IntensityFeatureScaleSpacePyramidApp<ImageUInt8, ImageSInt16> app2 =
    //				new
    // IntensityFeatureScaleSpacePyramidApp<ImageUInt8,ImageSInt16>(ImageUInt8.class,ImageSInt16.class);

    java.util.List<PathLabel> inputs = new ArrayList<PathLabel>();

    inputs.add(new PathLabel("shapes", "../data/evaluation/shapes01.png"));
    inputs.add(new PathLabel("sunflowers", "../data/evaluation/sunflowers.png"));
    inputs.add(new PathLabel("beach", "../data/evaluation/scale/beach02.jpg"));

    app.setInputList(inputs);

    // wait for it to process one image so that the size isn't all screwed up
    while (!app.getHasProcessedImage()) {
      Thread.yield();
    }

    ShowImages.showWindow(app, "Feature Scale Space Pyramid Intensity");
  }
コード例 #2
0
  private void setGridActions() {
    java.util.List actions = grid.getActions();

    actions.add(
        0,
        new GridAction(
            "reportAction", props.getProperty("reportAction.name"), WorkflowUiUtils.REPORT_ICON) {
          public void execute(ActionEvent e) {
            reportActionPerformed();
          }
        });

    actions.add(
        1,
        new GridAction(
            "showInfoAction",
            props.getProperty("showInfoAction.name"),
            WorkflowUiUtils.PREVIEW_ICON) {
          public void execute(ActionEvent e) {
            showInfoActionPerformed();
          }
        });

    actions.add(
        2,
        new GridAction(
            "printAction", props.getProperty("printAction.name"), WorkflowUiUtils.PRINT_ICON) {
          public void execute(ActionEvent e) {
            printActionPerformed();
          }
        });

    actions.add(
        3,
        new GridAction(
            "clearAction", props.getProperty("clearAction.name"), WorkflowUiUtils.CLEAR_ICON) {
          public void execute(ActionEvent e) {
            clearActionPerformed();
          }
        });

    actions.add(
        4,
        new GridAction(
            "helpAction", props.getProperty("helpAction.name"), WorkflowUiUtils.HELP_ICON) {
          public void execute(ActionEvent e) {
            try {
              Main.getHelpSystem().showHelp(className);
            } catch (HelpException e1) {
              e1.printStackTrace();
            }
          }
        });

    grid.setActions(actions);
  }
コード例 #3
0
 public void init() {
   // Let us take the roll no as a parameter from the html code
   lbl_rollNo = new JLabel(getParameter("RollNo"), JLabel.CENTER);
   lbl_rollNo.setSize(400, 400);
   fonts = new ArrayList<Font>();
   fonts.add(new Font(Font.MONOSPACED, Font.BOLD, 18));
   fonts.add(new Font(Font.SERIF, Font.ITALIC, 18));
   fonts.add(new Font("Pristina", Font.BOLD, 18));
   // More can be added as per the requirement
   this.setLayout(new BorderLayout());
   this.add(lbl_rollNo, BorderLayout.CENTER);
   this.setVisible(true);
 }
コード例 #4
0
  /**
   * Returns a list of all the SessionNodeWrappers (TetradNodes) and SessionNodeEdges that are model
   * components for the respective SessionNodes and SessionEdges selected in the workbench. Note
   * that the workbench, not the SessionEditorNodes themselves, keeps track of the selection.
   *
   * @return the set of selected model nodes.
   */
  public java.util.List getSelectedModelComponents() {
    java.util.List<Component> selectedComponents = workbench.getSelectedComponents();
    java.util.List<TetradSerializable> selectedModelComponents =
        new ArrayList<TetradSerializable>();

    for (Component comp : selectedComponents) {
      if (comp instanceof DisplayNode) {
        selectedModelComponents.add(((DisplayNode) comp).getModelNode());
      } else if (comp instanceof DisplayEdge) {
        selectedModelComponents.add(((DisplayEdge) comp).getModelEdge());
      }
    }

    return selectedModelComponents;
  }
コード例 #5
0
ファイル: ICICIMappingDisplay.java プロジェクト: thaond/pm2
  private Component iciciCodeMappings() {
    java.util.List<TableDisplayInput> displayInputs = new ArrayList<TableDisplayInput>();

    displayInputs.add(new StringDisplayInput("ICICICode", "getIciciCode"));
    displayInputs.add(new StringDisplayInput("StockCode", "getStockCode"));

    List<ICICICodeMapping> list = Controller.getIciciMappings();
    PMTableModel tableModel =
        new PMTableModel(list, displayInputs, false) {
          @Override
          public boolean isCellEditable(int rowIndex, int columnIndex) {
            return columnIndex == 1;
          }

          @Override
          public void setValueAt(Object value, int rowIndex, int columnIndex) {
            ((ICICICodeMapping) dataVOs.get(rowIndex)).setStock((StockVO) value);
          }
        };
    table = UIHelper.createTable(tableModel);
    table
        .getColumnModel()
        .getColumn(1)
        .setCellEditor(new DefaultCellEditor(UIHelper.createStockVOlistJCB()));
    return UIHelper.createScrollPane(table);
  }
コード例 #6
0
 private synchronized void addCommand(LogCommand command) {
   if (!myAlarm.isDisposed()) {
     myLog.add(command);
     myAlarm.cancelAllRequests();
     myAlarm.addRequest(myFlushLogRunnable, 100L);
   }
 }
コード例 #7
0
 private boolean isSynthIcon(Icon icon) {
   if (_synthIconMap == null) {
     _synthIconMap = new HashMap<String, Boolean>();
   }
   Class<?> aClass = icon.getClass();
   java.util.List<String> classNamesToPut = new ArrayList<String>();
   boolean isSynthIcon = false;
   while (aClass != null) {
     String name = aClass.getCanonicalName();
     if (name != null) {
       Boolean value = _synthIconMap.get(name);
       if (value != null) {
         return value;
       }
       classNamesToPut.add(name);
       if (isSynthIconClassName(name)) {
         isSynthIcon = true;
         break;
       }
     }
     aClass = aClass.getSuperclass();
   }
   for (String name : classNamesToPut) {
     _synthIconMap.put(name, isSynthIcon);
   }
   return isSynthIcon;
 }
コード例 #8
0
ファイル: DrawTool.java プロジェクト: tstamler/linAlg
 public static void drawImage(int[][][] pixels, int startX, int startY) {
   // Key idea: draw a bunch (lots of rectangles) with the appropriate color
   DrawObject R = new DrawObject();
   R.pixels = pixels;
   R.startX = startX;
   R.startY = startY;
   R.sequenceNum = currentSequenceNum;
   images.add(R);
   // Rescale if needed.
   int leftX = startX;
   int rightX = startX + pixels.length;
   int lowY = startY;
   int highY = startY + pixels[0].length;
   if (minX > leftX) {
     minX = leftX;
   }
   if (maxX < rightX) {
     maxX = rightX;
   }
   if (minY > lowY) {
     minY = lowY;
   }
   if (maxY < highY) {
     maxY = highY;
   }
   drawArea.repaint();
 }
コード例 #9
0
 public void init(java.util.List<Pair<String, TextWithImports>> data) {
   myData.clear();
   for (Iterator<Pair<String, TextWithImports>> it = data.iterator(); it.hasNext(); ) {
     final Pair<String, TextWithImports> pair = it.next();
     myData.add(new Row(pair.getFirst(), pair.getSecond()));
   }
 }
コード例 #10
0
 private int setDataDescriptors(java.util.List<DdsBean> beanList, DataDescriptor dds, int seqno) {
   for (DataDescriptor key : dds.getSubKeys()) {
     beanList.add(new DdsBean(key, seqno++));
     if (key.getSubKeys() != null) seqno = setDataDescriptors(beanList, key, seqno);
   }
   return seqno;
 }
コード例 #11
0
 private void clearDeleteRecord() {
   if (deleteList != null) {
     java.util.List list = deleteList.getSelection();
     if (list.size() > 0) {
       try {
         java.util.List dbIDs = new ArrayList(list.size());
         for (Iterator it = list.iterator(); it.hasNext(); ) {
           GKInstance instance = (GKInstance) it.next();
           dbIDs.add(instance.getDBID());
         }
         fileAdaptor.clearDeleteRecord(dbIDs);
       } catch (IOException e) {
         System.err.println("SynchronizationDialog.clearDeleteRecord(): " + e);
         e.printStackTrace();
       }
       deleteList.deleteInstances(list);
       // Check if deleteList needs to be removed
       if (deleteList.getDisplayedInstances().size() == 0) {
         centerPane.remove(deleteList);
         centerPane.validate();
         centerPane.repaint();
       }
     }
   }
 }
コード例 #12
0
  /**
   * enqueues the given runnable
   *
   * @param runnable a runnable
   */
  protected void invokeLater(Runnable runnable) {

    if (runnable != null) {

      queue.add(runnable);
    }
  }
コード例 #13
0
 public synchronized void actionPerformed(ActionEvent e) {
   java.util.List<JComponent> componentsToRemove = null;
   java.util.List<Part> partsToRemove = null;
   for (JComponent component : animationStateMap.keySet()) {
     component.repaint();
     if (partsToRemove != null) {
       partsToRemove.clear();
     }
     Map<Part, AnimationState> map = animationStateMap.get(component);
     if (!component.isShowing() || map == null || map.size() == 0) {
       if (componentsToRemove == null) {
         componentsToRemove = new ArrayList<JComponent>();
       }
       componentsToRemove.add(component);
       continue;
     }
     for (Part part : map.keySet()) {
       if (map.get(part).isDone()) {
         if (partsToRemove == null) {
           partsToRemove = new ArrayList<Part>();
         }
         partsToRemove.add(part);
       }
     }
     if (partsToRemove != null) {
       if (partsToRemove.size() == map.size()) {
         // animation is done for the component
         if (componentsToRemove == null) {
           componentsToRemove = new ArrayList<JComponent>();
         }
         componentsToRemove.add(component);
       } else {
         for (Part part : partsToRemove) {
           map.remove(part);
         }
       }
     }
   }
   if (componentsToRemove != null) {
     for (JComponent component : componentsToRemove) {
       animationStateMap.remove(component);
     }
   }
   if (animationStateMap.size() == 0) {
     timer.stop();
   }
 }
コード例 #14
0
  private void reestimate() {
    SemOptimizer optimizer;

    String type = wrapper.getSemOptimizerType();

    if ("Regression".equals(type)) {
      optimizer = new SemOptimizerRegression();
    } else if ("EM".equals(type)) {
      optimizer = new SemOptimizerEm();
    } else if ("Powell".equals(type)) {
      optimizer = new SemOptimizerPowell();
    } else if ("Random Search".equals(type)) {
      optimizer = new SemOptimizerScattershot();
    } else if ("RICF".equals(type)) {
      optimizer = new SemOptimizerRicf();
    } else if ("Powell".equals(type)) {
      optimizer = new SemOptimizerPowell();
    } else {
      throw new IllegalArgumentException("Unexpected optimizer " + "type: " + type);
    }

    int numRestarts = wrapper.getNumRestarts();
    optimizer.setNumRestarts(numRestarts);

    java.util.List<SemEstimator> estimators = wrapper.getMultipleResultList();
    java.util.List<SemEstimator> newEstimators = new ArrayList<>();

    for (SemEstimator estimator : estimators) {
      SemPm semPm = estimator.getSemPm();

      DataSet dataSet = estimator.getDataSet();
      ICovarianceMatrix covMatrix = estimator.getCovMatrix();

      SemEstimator newEstimator;

      if (dataSet != null) {
        newEstimator = new SemEstimator(dataSet, semPm, optimizer);
        newEstimator.setNumRestarts(numRestarts);
        newEstimator.setScoreType(wrapper.getScoreType());
      } else if (covMatrix != null) {
        newEstimator = new SemEstimator(covMatrix, semPm, optimizer);
        newEstimator.setNumRestarts(numRestarts);
        newEstimator.setScoreType(wrapper.getScoreType());
      } else {
        throw new IllegalStateException(
            "Only continuous "
                + "rectangular data sets and covariance matrices "
                + "can be processed.");
      }

      newEstimator.estimate();
      newEstimators.add(newEstimator);
    }

    wrapper.setSemEstimator(newEstimators.get(0));

    wrapper.setMultipleResultList(newEstimators);
    resetSemImEditor();
  }
コード例 #15
0
ファイル: SettingsPanel.java プロジェクト: r3dsk1n/supersonic
  public void saveSettings(int memoryLimit, int port, int httpsPort, String contextPath)
      throws SettingsException {
    File file = getOptionsFile();

    java.util.List<String> lines = readLines(file);
    java.util.List<String> newLines = new ArrayList<String>();

    boolean memoryLimitAdded = false;
    boolean portAdded = false;
    boolean httpsPortAdded = false;
    boolean contextPathAdded = false;

    for (String line : lines) {
      if (line.startsWith("-Xmx")) {
        newLines.add("-Xmx" + memoryLimit + "m");
        memoryLimitAdded = true;
      } else if (line.startsWith("-Dsubsonic.port=")) {
        newLines.add("-Dsubsonic.port=" + port);
        portAdded = true;
      } else if (line.startsWith("-Dsubsonic.httpsPort=")) {
        newLines.add("-Dsubsonic.httpsPort=" + httpsPort);
        httpsPortAdded = true;
      } else if (line.startsWith("-Dsubsonic.contextPath=")) {
        newLines.add("-Dsubsonic.contextPath=" + contextPath);
        contextPathAdded = true;
      } else {
        newLines.add(line);
      }
    }

    if (!memoryLimitAdded) {
      newLines.add("-Xmx" + memoryLimit + "m");
    }
    if (!portAdded) {
      newLines.add("-Dsubsonic.port=" + port);
    }
    if (!httpsPortAdded) {
      newLines.add("-Dsubsonic.httpsPort=" + httpsPort);
    }
    if (!contextPathAdded) {
      newLines.add("-Dsubsonic.contextPath=" + contextPath);
    }

    writeLines(file, newLines);

    JOptionPane.showMessageDialog(
        SettingsPanel.this,
        "Please restart Supersonic for the new settings to take effect.",
        "Settings changed",
        JOptionPane.INFORMATION_MESSAGE);
  }
コード例 #16
0
ファイル: DrawTool.java プロジェクト: tstamler/linAlg
 static void handleMouseDragged(MouseEvent e) {
   DrawObject L = new DrawObject();
   L.scribbleX = e.getX();
   L.scribbleY = e.getY();
   L.scribbleNum = currentScribbleNum;
   scribbles.add(L);
   drawArea.repaint();
 }
コード例 #17
0
  /** Gets the GUI component for this pane. */
  public JComponent getGUI() {
    if (cwp == null) {
      Object object = mWhiteBoard.get("device_definition");
      Object ctx_obj = mWhiteBoard.get("context");

      if (null != object
          && object instanceof ConfigDefinition
          && null != ctx_obj
          && ctx_obj instanceof ConfigContext) {
        mConfigContext = (ConfigContext) ctx_obj;

        ConfigDefinition def = (ConfigDefinition) object;
        String token = def.getToken();

        // Create a temporary list of ConfigDefinitions to pass to factory.
        java.util.List def_list = new ArrayList();
        def_list.add(def);

        // Initialize a ConfigElementFactory with the needed
        // ConfigDefinition. And create a new ConfigElement.
        ConfigElementFactory temp_factory = new ConfigElementFactory(def_list);
        mConfigElement = temp_factory.create("New " + token, def);

        List list = CustomEditorRegistry.findEditors(token);

        Color start_color = new Color(160, 160, 180);

        Object color = UIManager.get("window");
        if (null != color && color instanceof Color) {
          start_color = (Color) color;
        } else {
          System.out.println("Could not get the desktop color from the  UIManager.");
        }

        // XXX:This will be used after making findEditors -> findEditor
        // if(null != editor)
        if (null == list || list.size() == 0) {
          System.out.println("No CustomEditors registered for token: " + token);

          JScrollPane scroll_pane = new JScrollPane();
          PropertySheet element_prop_sheet =
              PropertySheetFactory.instance()
                  .makeSheet(mConfigContext, mConfigElement, start_color);

          scroll_pane.getViewport().removeAll();
          scroll_pane.getViewport().add(element_prop_sheet, null);
          cwp = scroll_pane;
        } else if (null != list && list.size() > 0) {
          CustomEditor editor = (CustomEditor) list.get(0);
          cwp = (JComponent) editor.getPanel();
          editor.setConfig(mConfigContext, mConfigElement);
        }
      }
    }
    // cwp.init(mWhiteBoard);
    return cwp;
  }
コード例 #18
0
ファイル: DrawTool.java プロジェクト: tstamler/linAlg
 public static void drawPoint(double x, double y) {
   DrawObject p = new DrawObject();
   p.color = pointColor;
   p.x = x;
   p.y = y;
   p.diameter = pointDiameter;
   p.sequenceNum = currentSequenceNum;
   if (animationMode) {
     synchronized (animPoints) {
       animPoints.add(p);
     }
   } else {
     synchronized (points) {
       points.add(p);
     }
   }
   drawArea.repaint();
 }
コード例 #19
0
ファイル: DrawTool.java プロジェクト: tstamler/linAlg
 public static void drawLabel(double x, double y, String str) {
   DrawObject L = new DrawObject();
   L.color = labelColor;
   L.x = x;
   L.y = y;
   L.str = str;
   L.sequenceNum = currentSequenceNum;
   if (animationMode) {
     synchronized (animLabels) {
       animLabels.add(L);
     }
   } else {
     synchronized (labels) {
       labels.add(L);
     }
   }
   drawArea.repaint();
 }
コード例 #20
0
  public static void main(String args[]) {
    DemoBinaryImageOpsApp app = new DemoBinaryImageOpsApp(GrayF32.class);

    java.util.List<PathLabel> inputs = new ArrayList<>();
    inputs.add(new PathLabel("particles", UtilIO.pathExample("particles01.jpg")));
    inputs.add(new PathLabel("shapes", UtilIO.pathExample("shapes/shapes01.png")));

    app.setInputList(inputs);

    // wait for it to process one image so that the size isn't all screwed up
    while (!app.getHasProcessedImage()) {
      Thread.yield();
    }

    ShowImages.showWindow(app, "Binary Image Ops", true);

    System.out.println("Done");
  }
コード例 #21
0
ファイル: BlueGoldApplet.java プロジェクト: kphannan/OpenLCB
  void createSampleNode(int index) {
    NodeID id;
    SingleProducer producer11;
    SingleProducer producer12;
    SingleProducer producer13;
    SingleConsumer consumer11;
    SingleConsumer consumer12;
    SingleConsumer consumer13;

    id = new NodeID(new byte[] {0, 0, 0, 0, 0, (byte) index});

    // create and connect the nodes
    producer11 = new SingleProducer(id, sg.getConnection(), new EventID(id, 1, 1));
    sg.register(producer11);

    producer12 = new SingleProducer(id, sg.getConnection(), new EventID(id, 1, 2));
    sg.register(producer12);

    producer13 = new SingleProducer(id, sg.getConnection(), new EventID(id, 1, 3));
    sg.register(producer13);

    consumer11 = new SingleConsumer(id, sg.getConnection(), new EventID(id, 0, 1));
    sg.register(consumer11);

    consumer12 = new SingleConsumer(id, sg.getConnection(), new EventID(id, 0, 2));
    sg.register(consumer12);

    consumer13 = new SingleConsumer(id, sg.getConnection(), new EventID(id, 0, 3));
    sg.register(consumer13);

    // composite GUI
    java.util.List<SingleProducer> producers = new ArrayList<SingleProducer>();
    producers.add(producer11);
    producers.add(producer12);
    producers.add(producer13);

    java.util.List<SingleConsumer> consumers = new ArrayList<SingleConsumer>();
    consumers.add(consumer11);
    consumers.add(consumer12);
    consumers.add(consumer13);
    JFrame f = new BGnodeFrame("BG simulated node " + index, producers, consumers, id, sg);
    f.pack();
    f.setVisible(true);
  }
コード例 #22
0
ファイル: NodeSelectionDialog.java プロジェクト: fdb/nodebox
 public void setSearchString(String searchString) {
   this.searchString = searchString.trim();
   if (searchString.length() == 0) {
     // Add all the nodes from the manager.
     filteredNodes = manager.getNodes();
     // Add all the exported nodes from the current library.
     filteredNodes.addAll(library.getExportedNodes());
   } else {
     filteredNodes = new ArrayList<Node>();
     // Add all the nodes from the manager.
     for (Node node : manager.getNodes()) {
       if (contains(node, searchString)) filteredNodes.add(node);
     }
     // Add all the exported nodes from the current library.
     for (Node node : library.getExportedNodes()) {
       if (contains(node, searchString)) filteredNodes.add(node);
     }
   }
 }
コード例 #23
0
  public static void main(String args[]) {
    FourierVisualizeApp app = new FourierVisualizeApp(ImageDataType.F32);
    //		FourierVisualizeApp app = new FourierVisualizeApp(ImageTypeInfo.F64);

    java.util.List<PathLabel> inputs = new ArrayList<PathLabel>();
    inputs.add(new PathLabel("lena", "../data/evaluation/standard/lena512.bmp"));
    inputs.add(new PathLabel("boat", "../data/evaluation/standard/boat.png"));
    inputs.add(new PathLabel("fingerprint", "../data/evaluation/standard/fingerprint.png"));
    inputs.add(new PathLabel("shapes", "../data/evaluation/shapes01.png"));
    inputs.add(new PathLabel("sunflowers", "../data/evaluation/sunflowers.png"));

    app.setInputList(inputs);

    // wait for it to process one image so that the size isn't all screwed up
    while (!app.getHasProcessedImage()) {
      Thread.yield();
    }

    ShowImages.showWindow(app, "Discrete Fourier Transform");
  }
コード例 #24
0
  /**
   * Registers a listener on the specified font chooser.
   *
   * <p>The specified listener will receive calls to its <code>setFont</code> method whenever the
   * font chooser has been updated.
   *
   * @param fontChooser chooser to monitor.
   * @param previewComponent component whose font should be tied to that of the chooser
   */
  protected void addFontChooserListener(FontChooser fontChooser, JComponent previewComponent) {
    // Update button font when a new font has been chosen in the FontChooser
    if (fontChooser != null) {
      ChangeListener listener;
      fontChooser.addChangeListener(listener = new PreviewFontChooserListener(previewComponent));
      previewComponent.setFont(fontChooser.getCurrentFont());

      // Hold a reference to this listener to prevent garbage collection
      listenerReferences.add(listener);
    }
  }
コード例 #25
0
ファイル: DrawTool.java プロジェクト: tstamler/linAlg
 public static void drawRectangle(double x1, double y1, double width, double height) {
   DrawObject R = new DrawObject();
   R.color = rectangleColor;
   R.x = x1;
   R.y = y1;
   R.width = width;
   R.height = height;
   R.sequenceNum = currentSequenceNum;
   R.drawStroke = drawStroke;
   if (animationMode) {
     synchronized (animRectangles) {
       animRectangles.add(R);
     }
   } else {
     synchronized (rectangles) {
       rectangles.add(R);
     }
   }
   drawArea.repaint();
 }
コード例 #26
0
  /**
   * Set the layer that a given shape will be displayed in. Since the shapes in this game are two
   * dimensional, it must be decided which will appear "on top" when two shapes overlap. The shape
   * in the higher layer will appear on top.
   *
   * <p>Setting a shape's layer will only affect how it is displayed; a shape's layer has no effect
   * on how it interacts with other shapes. (For example, two shapes can touch even if they are in
   * different layers. See {@link Shape#isTouching(Shape)}.)
   *
   * @param shape the shape whose layer is being set.
   * @param layer the layer into which this shape will be moved.
   */
  static void setLayer(Shape shape, int layer) {
    removeFromLayers(shape);

    // add new stuff
    if (!layerContents.containsKey(layer)) {
      layerContents.put(layer, new CopyOnWriteArrayList<Shape>());
      int insertionPoint = ~Collections.binarySearch(layers, layer);
      layers.add(insertionPoint, layer);
    }
    layerContents.get(layer).add(shape);
    layerOf.put(shape, layer);
  }
コード例 #27
0
ファイル: ListPanel.java プロジェクト: Aldor/fizteh-java-task
 public void addRow(Component... components) {
   remove(puff);
   final JPanel row = new JPanel();
   row.addMouseListener(
       new MouseAdapter() {
         @Override
         public void mouseClicked(MouseEvent event) {
           gui.notifyObserver("/use " + rows.indexOf(event.getSource()));
         }
       });
   row.setLayout(new BoxLayout(row, BoxLayout.X_AXIS));
   // row.add(Box.createHorizontalStrut(3));
   row.setMinimumSize(new Dimension(10, 30));
   row.setMaximumSize(new Dimension(250, 30));
   for (Component component : components) {
     row.add(component);
   }
   JButton red = new JButton("x");
   red.addActionListener(
       new ActionListener() {
         @Override
         public void actionPerformed(ActionEvent event) {
           int deleted = rows.indexOf(row);
           gui.notifyObserver("/use " + deleted);
           gui.notifyObserver("/disconnect");
         }
       });
   red.setBackground(Color.PINK.darker());
   red.setForeground(Color.WHITE);
   row.add(Box.createHorizontalGlue());
   row.add(red);
   rows.add(row);
   Component strut = Box.createVerticalStrut(5);
   struts.add(strut);
   add(row);
   add(strut);
   add(puff);
   repaint();
   updateUI();
 }
コード例 #28
0
 private void loadLieferant() {
   EntityManager em = Main.getEMF().createEntityManager();
   Query query = em.createQuery("SELECT l FROM Lieferanten l ORDER BY l.firma");
   try {
     java.util.List lieferant = query.getResultList();
     lieferant.add(0, "<html><i>Lieferant nicht &auml;ndern</i></html>");
     cmbLieferant.setModel(tools.Tools.newComboboxModel(new ArrayList<Lieferanten>(lieferant)));
   } catch (Exception e) { // nicht gefunden
     //
   } finally {
     em.close();
   }
 }
コード例 #29
0
ファイル: PlayerWaitingView.java プロジェクト: 255/catan
  @Override
  public void setAIChoices(String[] value) {

    java.util.List<String> choiceList = new ArrayList<String>();
    for (String v : value) {
      choiceList.add(v);
    }

    aiModel.setList(choiceList);

    if (value.length > 0) {
      aiChoices.setValue(value[0]);
    }
  }
コード例 #30
0
ファイル: DrawTool.java プロジェクト: tstamler/linAlg
 public static void drawLineFromEquation(double a, double b, double c) {
   // Draw the equation ax+by+c=0 in the available range.
   DrawObject L = new DrawObject();
   L.color = lineEqnColor;
   L.a = a;
   L.b = b;
   L.c = c;
   L.sequenceNum = currentSequenceNum;
   L.drawStroke = drawStroke;
   synchronized (eqnLines) {
     eqnLines.add(L);
   }
   drawArea.repaint();
 }