/** Initializes the components and adds them to the container. Called by the constructor. */
  private void layoutComponents() {
    MigLayout layout =
        new MigLayout(
            "hidemode 2, insets 0 0 0 0, gap 0!, novisualpadding",
            "[][grow]", // col constraints
            "[][][][grow]"); // row constraints

    setLayout(layout);
    setMinimumSize(new Dimension(getPreferredSize().width, 33));

    RectanglePainter tabHighlight = new RectanglePainter();
    tabHighlight.setFillPaint(
        new GradientPaint(
            20.0f,
            0.0f,
            tabHighlightTopGradientColor,
            20.0f,
            33.0f,
            tabHighlightBottomGradientColor));

    tabHighlight.setInsets(new Insets(0, 0, 1, 0));
    tabHighlight.setBorderPaint(null);

    HeaderBar header = new HeaderBar(searchTitleLabel);
    header.setLayout(new MigLayout("insets 0, gap 0!, novisualpadding, alignx 100%, aligny 50%"));
    header.add(browseStatusPanel, "alignx 0%, growx, pushx");
    headerBarDecorator.decorateBasic(header);

    sortAndFilterPanel.layoutComponents(header);

    add(header, "spanx 2, growx, growy, wrap");
    add(classicSearchReminderPanel, "spanx 2, growx, wrap");
    add(messagePanel, "spanx 2, growx, wrap");
    add(filterPanel, "grow");
    add(scrollPane, "hidemode 3, grow");
    add(browseFailedPanel, "hidemode 3, grow");

    scrollablePanel.setScrollableTracksViewportHeight(false);

    scrollablePanel.setLayout(new BorderLayout());
    scrollablePanel.add(resultsContainer, BorderLayout.CENTER);
    scrollablePanel.add(sponsoredResultsPanel, BorderLayout.EAST);
    scrollPane.setViewportView(scrollablePanel);

    syncScrollPieces();
  }
예제 #2
0
  /** Creates new form WorldMapForm */
  public WorldMapForm() {
    waypointPainter = new WaypointPainter();
    waypointPainter.setRenderer(new DefaultWaypointRenderer());

    RectanglePainter rp = new RectanglePainter(120, 25, 10, new Color(100, 100, 100, 150));
    rp.setInsets(new Insets(5, 0, 0, 0));
    rp.setVerticalAlignment(RectanglePainter.VerticalAlignment.TOP);
    final TextPainter tp = new TextPainter();
    tp.setInsets(new Insets(10, 0, 0, 0));
    tp.setText("stuff");
    tp.setFillPaint(Color.WHITE);
    tp.setVerticalAlignment(TextPainter.VerticalAlignment.TOP);

    initComponents();
    /*
    kit.setTileFactory(new CylindricalProjectionTileFactory(new SLMapServerInfo(
            "file:/Users/joshy/projects/java.net/ImageTileCutter/big_tiles_26000")));
    */
    kit.getMainMap().setOverlayPainter(new CompoundPainter(waypointPainter, rp, tp));
    kit.getMainMap()
        .addMouseMotionListener(
            new MouseMotionAdapter() {
              public void mouseMoved(MouseEvent e) {

                // get the screen point
                Point pt = e.getPoint();
                JXMapViewer map = kit.getMainMap();
                // u.p("pos = " + e.getPoint());
                // convert to world bitmap coords
                Rectangle rect = map.getViewportBounds();
                // u.p("rect = " + rect);
                pt.setLocation(rect.getX() - pt.getX(), rect.getY() - pt.getY());
                // u.p("pt = " + pt);
                // convert to geoposition
                GeoPosition gp = map.getTileFactory().pixelToGeo(pt, map.getZoom());
                u.p("gp " + gp);
                DecimalFormat fmt = new DecimalFormat("#00.000");
                tp.setText(fmt.format(gp.getLatitude()) + " , " + fmt.format(gp.getLongitude()));
                map.repaint();
              }
            });
  }