Example usage for javax.swing JLabel setFont

List of usage examples for javax.swing JLabel setFont

Introduction

In this page you can find the example usage for javax.swing JLabel setFont.

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The font for the component.")
public void setFont(Font font) 

Source Link

Document

Sets the font for this component.

Usage

From source file:com.google.code.facebook.graph.sna.applet.MinimumSpanningTreeDemo.java

/**
 * create an instance of a simple graph in two views with controls to
 * demo the zoom features./*  www.j a va 2s.  c o  m*/
 * 
 */
public MinimumSpanningTreeDemo() {

    // create a simple graph for the demo
    // both models will share one graph
    graph = TestGraphs.getDemoGraph();

    MinimumSpanningForest2<String, Number> prim = new MinimumSpanningForest2<String, Number>(graph,
            new DelegateForest<String, Number>(), DelegateTree.<String, Number>getFactory(),
            new ConstantTransformer(1.0));

    tree = prim.getForest();

    // create two layouts for the one graph, one layout for each model
    Layout<String, Number> layout0 = new KKLayout<String, Number>(graph);
    layout0.setSize(preferredLayoutSize);
    Layout<String, Number> layout1 = new TreeLayout<String, Number>(tree);
    Layout<String, Number> layout2 = new StaticLayout<String, Number>(graph, layout1);

    // create the two models, each with a different layout
    VisualizationModel<String, Number> vm0 = new DefaultVisualizationModel<String, Number>(layout0,
            preferredSize);
    VisualizationModel<String, Number> vm1 = new DefaultVisualizationModel<String, Number>(layout1,
            preferredSizeRect);
    VisualizationModel<String, Number> vm2 = new DefaultVisualizationModel<String, Number>(layout2,
            preferredSizeRect);

    // create the two views, one for each model
    // they share the same renderer
    vv0 = new VisualizationViewer<String, Number>(vm0, preferredSize);
    vv1 = new VisualizationViewer<String, Number>(vm1, preferredSizeRect);
    vv2 = new VisualizationViewer<String, Number>(vm2, preferredSizeRect);

    //        vv1.setRenderContext(vv2.getRenderContext());

    vv1.getRenderContext().setMultiLayerTransformer(vv0.getRenderContext().getMultiLayerTransformer());
    vv2.getRenderContext().setMultiLayerTransformer(vv0.getRenderContext().getMultiLayerTransformer());

    vv1.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());

    vv0.addChangeListener(vv1);
    vv1.addChangeListener(vv2);

    vv0.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
    vv2.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());

    Color back = Color.decode("0xffffbb");
    vv0.setBackground(back);
    vv1.setBackground(back);
    vv2.setBackground(back);

    vv0.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR);
    vv0.setForeground(Color.darkGray);
    vv1.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR);
    vv1.setForeground(Color.darkGray);
    vv2.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR);
    vv2.setForeground(Color.darkGray);

    // share one PickedState between the two views
    PickedState<String> ps = new MultiPickedState<String>();
    vv0.setPickedVertexState(ps);
    vv1.setPickedVertexState(ps);
    vv2.setPickedVertexState(ps);

    PickedState<Number> pes = new MultiPickedState<Number>();
    vv0.setPickedEdgeState(pes);
    vv1.setPickedEdgeState(pes);
    vv2.setPickedEdgeState(pes);

    // set an edge paint function that will show picking for edges
    vv0.getRenderContext().setEdgeDrawPaintTransformer(
            new PickableEdgePaintTransformer<Number>(vv0.getPickedEdgeState(), Color.black, Color.red));
    vv0.getRenderContext().setVertexFillPaintTransformer(
            new PickableVertexPaintTransformer<String>(vv0.getPickedVertexState(), Color.red, Color.yellow));
    vv1.getRenderContext().setEdgeDrawPaintTransformer(
            new PickableEdgePaintTransformer<Number>(vv1.getPickedEdgeState(), Color.black, Color.red));
    vv1.getRenderContext().setVertexFillPaintTransformer(
            new PickableVertexPaintTransformer<String>(vv1.getPickedVertexState(), Color.red, Color.yellow));

    // add default listeners for ToolTips
    vv0.setVertexToolTipTransformer(new ToStringLabeller());
    vv1.setVertexToolTipTransformer(new ToStringLabeller());
    vv2.setVertexToolTipTransformer(new ToStringLabeller());

    vv0.setLayout(new BorderLayout());
    vv1.setLayout(new BorderLayout());
    vv2.setLayout(new BorderLayout());

    Font font = vv0.getFont().deriveFont(Font.BOLD, 16);
    JLabel vv0Label = new JLabel("<html>Original Graph<p>using KKLayout");
    vv0Label.setFont(font);
    JLabel vv1Label = new JLabel("Minimum Spanning Trees");
    vv1Label.setFont(font);
    JLabel vv2Label = new JLabel("Original Graph using TreeLayout");
    vv2Label.setFont(font);
    JPanel flow0 = new JPanel();
    flow0.setOpaque(false);
    JPanel flow1 = new JPanel();
    flow1.setOpaque(false);
    JPanel flow2 = new JPanel();
    flow2.setOpaque(false);
    flow0.add(vv0Label);
    flow1.add(vv1Label);
    flow2.add(vv2Label);
    vv0.add(flow0, BorderLayout.NORTH);
    vv1.add(flow1, BorderLayout.NORTH);
    vv2.add(flow2, BorderLayout.NORTH);

    //        vv2.getRenderContext().setEdgeDrawPaintTransformer(new Transformer<Number,Paint>() {
    //
    //         public Paint transform(Number e) {
    //            if(tree.getEdges().contains(e) == false) return Color.lightGray;
    //            return Color.black;
    //         }});

    Container content = getContentPane();
    JPanel grid = new JPanel(new GridLayout(0, 1));
    JPanel panel = new JPanel(new BorderLayout());
    panel.add(new GraphZoomScrollPane(vv0), BorderLayout.WEST);
    grid.add(new GraphZoomScrollPane(vv1));
    grid.add(new GraphZoomScrollPane(vv2));
    //        panel.add(new GraphZoomScrollPane(vv3), BorderLayout.EAST);
    panel.add(grid);

    content.add(panel);

    // create a GraphMouse for each view
    DefaultModalGraphMouse gm0 = new DefaultModalGraphMouse();
    DefaultModalGraphMouse gm1 = new DefaultModalGraphMouse();
    DefaultModalGraphMouse gm2 = new DefaultModalGraphMouse();
    DefaultModalGraphMouse gm3 = new DefaultModalGraphMouse();

    vv0.setGraphMouse(gm0);
    vv1.setGraphMouse(gm1);
    vv2.setGraphMouse(gm2);
    //        vv3.setGraphMouse(gm3);

    // create zoom buttons for scaling the transformer that is
    // shared between the two models.
    final ScalingControl scaler = new CrossoverScalingControl();

    vv0.scaleToLayout(scaler);
    vv1.scaleToLayout(scaler);
    vv2.scaleToLayout(scaler);
    //        vv3.scaleToLayout(scaler);

    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv1, 1.1f, vv1.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv1, 1 / 1.1f, vv1.getCenter());
        }
    });

    JPanel zoomPanel = new JPanel(new GridLayout(1, 2));
    zoomPanel.setBorder(BorderFactory.createTitledBorder("Zoom"));

    JPanel modePanel = new JPanel();
    modePanel.setBorder(BorderFactory.createTitledBorder("Mouse Mode"));
    gm1.getModeComboBox().addItemListener(gm2.getModeListener());
    gm1.getModeComboBox().addItemListener(gm0.getModeListener());
    gm1.getModeComboBox().addItemListener(gm3.getModeListener());
    modePanel.add(gm1.getModeComboBox());

    JPanel controls = new JPanel();
    zoomPanel.add(plus);
    zoomPanel.add(minus);
    controls.add(zoomPanel);
    controls.add(modePanel);
    content.add(controls, BorderLayout.SOUTH);
}

From source file:demos.MinimumSpanningTreeDemo.java

/**
 * create an instance of a simple graph in two views with controls to demo
 * the zoom features.//from  w ww  .  j  a va  2  s .c om
 * 
 */
public MinimumSpanningTreeDemo() {

    // create a simple graph for the demo
    // both models will share one graph
    graph = TestGraphs.getDemoGraph();

    MinimumSpanningForest2<String, Number> prim = new MinimumSpanningForest2<String, Number>(graph,
            new DelegateForest<String, Number>(), DelegateTree.<String, Number>getFactory(),
            new ConstantTransformer(1.0));

    tree = prim.getForest();

    // create two layouts for the one graph, one layout for each model
    Layout<String, Number> layout0 = new KKLayout<String, Number>(graph);
    layout0.setSize(preferredLayoutSize);
    Layout<String, Number> layout1 = new TreeLayout<String, Number>(tree);
    Layout<String, Number> layout2 = new StaticLayout<String, Number>(graph, layout1);

    // create the two models, each with a different layout
    VisualizationModel<String, Number> vm0 = new DefaultVisualizationModel<String, Number>(layout0,
            preferredSize);
    VisualizationModel<String, Number> vm1 = new DefaultVisualizationModel<String, Number>(layout1,
            preferredSizeRect);
    VisualizationModel<String, Number> vm2 = new DefaultVisualizationModel<String, Number>(layout2,
            preferredSizeRect);

    // create the two views, one for each model
    // they share the same renderer
    vv0 = new VisualizationViewer<String, Number>(vm0, preferredSize);
    vv1 = new VisualizationViewer<String, Number>(vm1, preferredSizeRect);
    vv2 = new VisualizationViewer<String, Number>(vm2, preferredSizeRect);

    // vv1.setRenderContext(vv2.getRenderContext());

    vv1.getRenderContext().setMultiLayerTransformer(vv0.getRenderContext().getMultiLayerTransformer());
    vv2.getRenderContext().setMultiLayerTransformer(vv0.getRenderContext().getMultiLayerTransformer());

    vv1.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());

    vv0.addChangeListener(vv1);
    vv1.addChangeListener(vv2);

    vv0.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
    vv2.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());

    Color back = Color.decode("0xffffbb");
    vv0.setBackground(back);
    vv1.setBackground(back);
    vv2.setBackground(back);

    vv0.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR);
    vv0.setForeground(Color.darkGray);
    vv1.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR);
    vv1.setForeground(Color.darkGray);
    vv2.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR);
    vv2.setForeground(Color.darkGray);

    // share one PickedState between the two views
    PickedState<String> ps = new MultiPickedState<String>();
    vv0.setPickedVertexState(ps);
    vv1.setPickedVertexState(ps);
    vv2.setPickedVertexState(ps);

    PickedState<Number> pes = new MultiPickedState<Number>();
    vv0.setPickedEdgeState(pes);
    vv1.setPickedEdgeState(pes);
    vv2.setPickedEdgeState(pes);

    // set an edge paint function that will show picking for edges
    vv0.getRenderContext().setEdgeDrawPaintTransformer(
            new PickableEdgePaintTransformer<Number>(vv0.getPickedEdgeState(), Color.black, Color.red));
    vv0.getRenderContext().setVertexFillPaintTransformer(
            new PickableVertexPaintTransformer<String>(vv0.getPickedVertexState(), Color.red, Color.yellow));
    vv1.getRenderContext().setEdgeDrawPaintTransformer(
            new PickableEdgePaintTransformer<Number>(vv1.getPickedEdgeState(), Color.black, Color.red));
    vv1.getRenderContext().setVertexFillPaintTransformer(
            new PickableVertexPaintTransformer<String>(vv1.getPickedVertexState(), Color.red, Color.yellow));

    // add default listeners for ToolTips
    vv0.setVertexToolTipTransformer(new ToStringLabeller());
    vv1.setVertexToolTipTransformer(new ToStringLabeller());
    vv2.setVertexToolTipTransformer(new ToStringLabeller());

    vv0.setLayout(new BorderLayout());
    vv1.setLayout(new BorderLayout());
    vv2.setLayout(new BorderLayout());

    Font font = vv0.getFont().deriveFont(Font.BOLD, 16);
    JLabel vv0Label = new JLabel("<html>Original Graph<p>using KKLayout");
    vv0Label.setFont(font);
    JLabel vv1Label = new JLabel("Minimum Spanning Trees");
    vv1Label.setFont(font);
    JLabel vv2Label = new JLabel("Original Graph using TreeLayout");
    vv2Label.setFont(font);
    JPanel flow0 = new JPanel();
    flow0.setOpaque(false);
    JPanel flow1 = new JPanel();
    flow1.setOpaque(false);
    JPanel flow2 = new JPanel();
    flow2.setOpaque(false);
    flow0.add(vv0Label);
    flow1.add(vv1Label);
    flow2.add(vv2Label);
    vv0.add(flow0, BorderLayout.NORTH);
    vv1.add(flow1, BorderLayout.NORTH);
    vv2.add(flow2, BorderLayout.NORTH);

    // vv2.getRenderContext().setEdgeDrawPaintTransformer(new
    // Transformer<Number,Paint>() {
    //
    // public Paint transform(Number e) {
    // if(tree.getEdges().contains(e) == false) return Color.lightGray;
    // return Color.black;
    // }});

    Container content = getContentPane();
    JPanel grid = new JPanel(new GridLayout(0, 1));
    JPanel panel = new JPanel(new BorderLayout());
    panel.add(new GraphZoomScrollPane(vv0), BorderLayout.WEST);
    grid.add(new GraphZoomScrollPane(vv1));
    grid.add(new GraphZoomScrollPane(vv2));
    // panel.add(new GraphZoomScrollPane(vv3), BorderLayout.EAST);
    panel.add(grid);

    content.add(panel);

    // create a GraphMouse for each view
    DefaultModalGraphMouse gm0 = new DefaultModalGraphMouse();
    DefaultModalGraphMouse gm1 = new DefaultModalGraphMouse();
    DefaultModalGraphMouse gm2 = new DefaultModalGraphMouse();
    DefaultModalGraphMouse gm3 = new DefaultModalGraphMouse();

    vv0.setGraphMouse(gm0);
    vv1.setGraphMouse(gm1);
    vv2.setGraphMouse(gm2);
    // vv3.setGraphMouse(gm3);

    // create zoom buttons for scaling the transformer that is
    // shared between the two models.
    final ScalingControl scaler = new CrossoverScalingControl();

    vv0.scaleToLayout(scaler);
    vv1.scaleToLayout(scaler);
    vv2.scaleToLayout(scaler);
    // vv3.scaleToLayout(scaler);

    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv1, 1.1f, vv1.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv1, 1 / 1.1f, vv1.getCenter());
        }
    });

    JPanel zoomPanel = new JPanel(new GridLayout(1, 2));
    zoomPanel.setBorder(BorderFactory.createTitledBorder("Zoom"));

    JPanel modePanel = new JPanel();
    modePanel.setBorder(BorderFactory.createTitledBorder("Mouse Mode"));
    gm1.getModeComboBox().addItemListener(gm2.getModeListener());
    gm1.getModeComboBox().addItemListener(gm0.getModeListener());
    gm1.getModeComboBox().addItemListener(gm3.getModeListener());
    modePanel.add(gm1.getModeComboBox());

    JPanel controls = new JPanel();
    zoomPanel.add(plus);
    zoomPanel.add(minus);
    controls.add(zoomPanel);
    controls.add(modePanel);
    content.add(controls, BorderLayout.SOUTH);
}

From source file:edu.uci.ics.jung.samples.MinimumSpanningTreeDemo.java

/**
 * create an instance of a simple graph in two views with controls to
 * demo the zoom features.//from  w ww . j av a 2 s. c  o  m
 * 
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
public MinimumSpanningTreeDemo() {

    // create a simple graph for the demo
    // both models will share one graph
    graph = TestGraphs.getDemoGraph();

    MinimumSpanningForest2<String, Number> prim = new MinimumSpanningForest2<String, Number>(graph,
            new DelegateForest<String, Number>(), DelegateTree.<String, Number>getFactory(),
            new ConstantTransformer(1.0));

    tree = prim.getForest();

    // create two layouts for the one graph, one layout for each model
    Layout<String, Number> layout0 = new KKLayout<String, Number>(graph);
    layout0.setSize(preferredLayoutSize);
    Layout<String, Number> layout1 = new TreeLayout<String, Number>(tree);
    Layout<String, Number> layout2 = new StaticLayout<String, Number>(graph, layout1);

    // create the two models, each with a different layout
    VisualizationModel<String, Number> vm0 = new DefaultVisualizationModel<String, Number>(layout0,
            preferredSize);
    VisualizationModel<String, Number> vm1 = new DefaultVisualizationModel<String, Number>(layout1,
            preferredSizeRect);
    VisualizationModel<String, Number> vm2 = new DefaultVisualizationModel<String, Number>(layout2,
            preferredSizeRect);

    // create the two views, one for each model
    // they share the same renderer
    vv0 = new VisualizationViewer<String, Number>(vm0, preferredSize);
    vv1 = new VisualizationViewer<String, Number>(vm1, preferredSizeRect);
    vv2 = new VisualizationViewer<String, Number>(vm2, preferredSizeRect);

    //        vv1.setRenderContext(vv2.getRenderContext());

    vv1.getRenderContext().setMultiLayerTransformer(vv0.getRenderContext().getMultiLayerTransformer());
    vv2.getRenderContext().setMultiLayerTransformer(vv0.getRenderContext().getMultiLayerTransformer());

    vv1.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line());

    vv0.addChangeListener(vv1);
    vv1.addChangeListener(vv2);

    vv0.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
    vv2.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());

    Color back = Color.decode("0xffffbb");
    vv0.setBackground(back);
    vv1.setBackground(back);
    vv2.setBackground(back);

    vv0.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR);
    vv0.setForeground(Color.darkGray);
    vv1.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR);
    vv1.setForeground(Color.darkGray);
    vv2.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR);
    vv2.setForeground(Color.darkGray);

    // share one PickedState between the two views
    PickedState<String> ps = new MultiPickedState<String>();
    vv0.setPickedVertexState(ps);
    vv1.setPickedVertexState(ps);
    vv2.setPickedVertexState(ps);

    PickedState<Number> pes = new MultiPickedState<Number>();
    vv0.setPickedEdgeState(pes);
    vv1.setPickedEdgeState(pes);
    vv2.setPickedEdgeState(pes);

    // set an edge paint function that will show picking for edges
    vv0.getRenderContext().setEdgeDrawPaintTransformer(
            new PickableEdgePaintTransformer<Number>(vv0.getPickedEdgeState(), Color.black, Color.red));
    vv0.getRenderContext().setVertexFillPaintTransformer(
            new PickableVertexPaintTransformer<String>(vv0.getPickedVertexState(), Color.red, Color.yellow));
    vv1.getRenderContext().setEdgeDrawPaintTransformer(
            new PickableEdgePaintTransformer<Number>(vv1.getPickedEdgeState(), Color.black, Color.red));
    vv1.getRenderContext().setVertexFillPaintTransformer(
            new PickableVertexPaintTransformer<String>(vv1.getPickedVertexState(), Color.red, Color.yellow));

    // add default listeners for ToolTips
    vv0.setVertexToolTipTransformer(new ToStringLabeller());
    vv1.setVertexToolTipTransformer(new ToStringLabeller());
    vv2.setVertexToolTipTransformer(new ToStringLabeller());

    vv0.setLayout(new BorderLayout());
    vv1.setLayout(new BorderLayout());
    vv2.setLayout(new BorderLayout());

    Font font = vv0.getFont().deriveFont(Font.BOLD, 16);
    JLabel vv0Label = new JLabel("<html>Original Graph<p>using KKLayout");
    vv0Label.setFont(font);
    JLabel vv1Label = new JLabel("Minimum Spanning Trees");
    vv1Label.setFont(font);
    JLabel vv2Label = new JLabel("Original Graph using TreeLayout");
    vv2Label.setFont(font);
    JPanel flow0 = new JPanel();
    flow0.setOpaque(false);
    JPanel flow1 = new JPanel();
    flow1.setOpaque(false);
    JPanel flow2 = new JPanel();
    flow2.setOpaque(false);
    flow0.add(vv0Label);
    flow1.add(vv1Label);
    flow2.add(vv2Label);
    vv0.add(flow0, BorderLayout.NORTH);
    vv1.add(flow1, BorderLayout.NORTH);
    vv2.add(flow2, BorderLayout.NORTH);

    //        vv2.getRenderContext().setEdgeDrawPaintTransformer(new Transformer<Number,Paint>() {
    //
    //         public Paint transform(Number e) {
    //            if(tree.getEdges().contains(e) == false) return Color.lightGray;
    //            return Color.black;
    //         }});

    Container content = getContentPane();
    JPanel grid = new JPanel(new GridLayout(0, 1));
    JPanel panel = new JPanel(new BorderLayout());
    panel.add(new GraphZoomScrollPane(vv0), BorderLayout.WEST);
    grid.add(new GraphZoomScrollPane(vv1));
    grid.add(new GraphZoomScrollPane(vv2));
    //        panel.add(new GraphZoomScrollPane(vv3), BorderLayout.EAST);
    panel.add(grid);

    content.add(panel);

    // create a GraphMouse for each view
    DefaultModalGraphMouse gm0 = new DefaultModalGraphMouse();
    DefaultModalGraphMouse gm1 = new DefaultModalGraphMouse();
    DefaultModalGraphMouse gm2 = new DefaultModalGraphMouse();
    DefaultModalGraphMouse gm3 = new DefaultModalGraphMouse();

    vv0.setGraphMouse(gm0);
    vv1.setGraphMouse(gm1);
    vv2.setGraphMouse(gm2);
    //        vv3.setGraphMouse(gm3);

    // create zoom buttons for scaling the transformer that is
    // shared between the two models.
    final ScalingControl scaler = new CrossoverScalingControl();

    vv0.scaleToLayout(scaler);
    vv1.scaleToLayout(scaler);
    vv2.scaleToLayout(scaler);
    //        vv3.scaleToLayout(scaler);

    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv1, 1.1f, vv1.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv1, 1 / 1.1f, vv1.getCenter());
        }
    });

    JPanel zoomPanel = new JPanel(new GridLayout(1, 2));
    zoomPanel.setBorder(BorderFactory.createTitledBorder("Zoom"));

    JPanel modePanel = new JPanel();
    modePanel.setBorder(BorderFactory.createTitledBorder("Mouse Mode"));
    gm1.getModeComboBox().addItemListener(gm2.getModeListener());
    gm1.getModeComboBox().addItemListener(gm0.getModeListener());
    gm1.getModeComboBox().addItemListener(gm3.getModeListener());
    modePanel.add(gm1.getModeComboBox());

    JPanel controls = new JPanel();
    zoomPanel.add(plus);
    zoomPanel.add(minus);
    controls.add(zoomPanel);
    controls.add(modePanel);
    content.add(controls, BorderLayout.SOUTH);
}

From source file:com.game.ui.views.PlayerEditor.java

public void doGui() {
    //        setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    setLayout(new GridBagLayout());
    GridBagConstraints c1 = new GridBagConstraints();
    c1.fill = GridBagConstraints.NONE;
    c1.anchor = GridBagConstraints.WEST;
    c1.insets = new Insets(10, 5, 10, 5);
    c1.weightx = 0;//from   w w  w.  j  av  a2 s. c om
    c1.weighty = 0;
    JLabel noteLbl = new JLabel("Pls select a value to choose a Player or you can create a new "
            + "Player entity below. Once selected a Player character, its' details will be available below");
    add(noteLbl, c1);
    DefaultComboBoxModel model = new DefaultComboBoxModel();
    for (GameCharacter character : GameBean.playerDetails) {
        model.addElement(((Player) character).getType());
    }
    c1.gridy = 1;
    comboBox = new JComboBox(model);
    comboBox.setSelectedIndex(-1);
    comboBox.setMaximumSize(new Dimension(100, 30));
    comboBox.setActionCommand("dropDown");
    comboBox.addActionListener(this);
    add(comboBox, c1);
    JPanel wrapperPanel = new JPanel(new GridLayout(1, 2, 10, 10));
    wrapperPanel.setBorder(LineBorder.createGrayLineBorder());
    leftPanel = new JPanel();
    leftPanel.setAlignmentX(0);
    leftPanel.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(5, 5, 5, 5);
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = 2;
    JLabel enemyDtlLbl = new JLabel("Enemy Character Details : ");
    enemyDtlLbl.setFont(new Font("Times New Roman", Font.BOLD, 15));
    leftPanel.add(enemyDtlLbl, c);
    c.gridwidth = 1;
    c.gridy = 1;
    JLabel nameLbl = new JLabel("Name : ");
    leftPanel.add(nameLbl, c);
    c.gridx = 1;
    JTextField name = new JTextField("");
    name.setColumns(20);
    leftPanel.add(name, c);
    c.gridx = 0;
    c.gridy = 2;
    JLabel imageLbl = new JLabel("Image Path : ");
    leftPanel.add(imageLbl, c);
    c.gridx = 1;
    JTextField image = new JTextField("");
    image.setColumns(20);
    leftPanel.add(image, c);
    c.gridx = 0;
    c.gridy = 3;
    JLabel healthLbl = new JLabel("Health Pts : ");
    leftPanel.add(healthLbl, c);
    c.gridx = 1;
    JTextField health = new JTextField("");
    health.setColumns(20);
    leftPanel.add(health, c);
    c.gridx = 0;
    c.gridy = 4;
    JLabel attackPtsLbl = new JLabel("Attack Points : ");
    leftPanel.add(attackPtsLbl, c);
    c.gridx = 1;
    JTextField attackPts = new JTextField("");
    attackPts.setColumns(20);
    leftPanel.add(attackPts, c);
    c.gridx = 0;
    c.gridy = 5;
    JLabel armoursPtsLbl = new JLabel("Armour Points : ");
    leftPanel.add(armoursPtsLbl, c);
    c.gridx = 1;
    JTextField armourPts = new JTextField("");
    armourPts.setColumns(20);
    leftPanel.add(armourPts, c);
    c.gridx = 0;
    c.gridy = 6;
    JLabel attackRngeLbl = new JLabel("Attack Range : ");
    leftPanel.add(attackRngeLbl, c);
    c.gridx = 1;
    JTextField attackRnge = new JTextField("");
    attackRnge.setColumns(20);
    leftPanel.add(attackRnge, c);
    c.gridx = 0;
    c.gridy = 7;
    JLabel movementLbl = new JLabel("Movement : ");
    leftPanel.add(movementLbl, c);
    c.gridx = 1;
    JTextField movement = new JTextField("");
    movement.setColumns(20);
    leftPanel.add(movement, c);
    c.gridx = 0;
    c.gridy = 8;
    JLabel typeLbl = new JLabel("Type : ");
    leftPanel.add(typeLbl, c);
    c.gridx = 1;
    JTextField typeTxt = new JTextField("");
    typeTxt.setColumns(20);
    leftPanel.add(typeTxt, c);
    c.gridx = 0;
    c.gridy = 9;
    JLabel weaponLbl = new JLabel("Equipped Weapon : ");
    leftPanel.add(weaponLbl, c);
    c.gridx = 1;
    DefaultComboBoxModel weapon = new DefaultComboBoxModel();
    for (Item item : GameBean.weaponDetails) {
        if (item instanceof Weapon) {
            weapon.addElement(((Weapon) item).getName());
        }
    }
    JComboBox weaponDrpDown = new JComboBox(weapon);
    weaponDrpDown.setSelectedIndex(-1);
    weaponDrpDown.setMaximumSize(new Dimension(100, 30));
    leftPanel.add(weaponDrpDown, c);
    c.gridx = 0;
    c.gridy = 10;
    c.gridwidth = 2;
    JButton submit = new JButton("Save");
    submit.addActionListener(this);
    submit.setActionCommand("button");
    leftPanel.add(submit, c);
    wrapperPanel.add(leftPanel);
    lvlPanel = new LevelPanel(true, null);
    wrapperPanel.add(lvlPanel);
    c1.gridy = 2;
    c1.fill = GridBagConstraints.BOTH;
    add(wrapperPanel, c1);
    c1.fill = GridBagConstraints.NONE;
    validationMess = new JLabel("Pls enter all the fields or pls choose a character from the drop down");
    validationMess.setForeground(Color.red);
    validationMess.setVisible(false);
    c1.gridy = 3;
    add(validationMess, c1);
    c1.weightx = 1;
    c1.fill = GridBagConstraints.BOTH;
    c1.weighty = 1;
    c1.gridy = 4;
    add(new JPanel(), c1);
}

From source file:org.nebulaframework.ui.swing.cluster.ClusterMainUI.java

/**
 * Displays Splash Screen/* w w  w.j  a  v  a2  s .  c o  m*/
 * 
 * @return Splash Screen Reference
 */
public static JWindow showSplash() {

    JWindow splash = new JWindow();
    splash.setSize(400, 250);
    splash.setLayout(null);

    JLabel status = new JLabel("Developed by Yohan Liyanage, 2008");
    JLabelAppender.setLabel(status);
    status.setFont(new Font("sansserif", Font.PLAIN, 10));
    status.setSize(350, 30);
    status.setLocation(10, 220);
    splash.add(status);

    JLabel lbl = new JLabel(
            new ImageIcon(ClassLoader.getSystemResource("META-INF/resources/nebula-startup.png")));
    lbl.setSize(400, 250);
    lbl.setLocation(0, 0);
    splash.add(lbl);

    splash.setVisible(true);
    splash.setLocationRelativeTo(null);

    return splash;
}

From source file:com.willwinder.ugs.nbp.setupwizard.panels.WizardPanelStepCalibration.java

private void addHeaderRow(JPanel panel) {
    Font labelHeaderFont = new Font(Font.SANS_SERIF, Font.BOLD, 16);
    JLabel headerLabel = new JLabel(Localization.getString("platform.plugin.setupwizard.move"), JLabel.CENTER);
    headerLabel.setFont(labelHeaderFont);
    panel.add(headerLabel, "growx, spanx 3, gapbottom 5, gaptop 7");
    panel.add(new JSeparator(SwingConstants.VERTICAL), "spany 5, gapleft 5, gapright 5, wmin 10, grow");

    headerLabel = new JLabel(Localization.getString("platform.plugin.setupwizard.measure"), JLabel.CENTER);
    headerLabel.setFont(labelHeaderFont);
    panel.add(headerLabel, "growx, spanx 2, gapbottom 5, gaptop 7");
    panel.add(new JSeparator(SwingConstants.VERTICAL), "spany 5, gapleft 5, gapright 5, wmin 10, grow");

    headerLabel = new JLabel(Localization.getString("platform.plugin.setupwizard.calibrate"), JLabel.CENTER);
    headerLabel.setFont(labelHeaderFont);
    panel.add(headerLabel, "growx, spanx 3, wrap, gapbottom 5, gaptop 7");
}

From source file:cz.alej.michalik.totp.client.AddDialog.java

public AddDialog(final Properties prop) {
    System.out.println("Pridat novy zaznam");
    this.setTitle("Pidat");
    this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    this.setMinimumSize(new Dimension(600, 150));
    this.setLocationByPlatform(true);
    // Panel pro vytvoen okraj
    JPanel panel = new JPanel();
    panel.setBorder(new EmptyBorder(10, 10, 10, 10));
    panel.setLayout(new GridBagLayout());
    // Vlastnosti pro popisky
    GridBagConstraints label = new GridBagConstraints();
    label.insets = new Insets(2, 2, 2, 2);
    label.fill = GridBagConstraints.NONE;
    label.weightx = 1;/*from   w w w. j a  va 2 s . c om*/
    // Vlastnosti pro pole
    GridBagConstraints field = new GridBagConstraints();
    field.insets = new Insets(2, 2, 2, 2);
    field.fill = GridBagConstraints.HORIZONTAL;
    field.weightx = 10;

    this.add(panel);

    // Nastavm ikonu okna
    try {
        String path = "/material-design-icons/content/drawable-xhdpi/ic_create_black_48dp.png";
        this.setIconImage(Toolkit.getDefaultToolkit().getImage(App.class.getResource(path)));
    } catch (NullPointerException ex) {
        System.out.println("Icon not found");
    }

    // Pole pro pojmenovn zznamu
    // Ikona
    ImageIcon icon = null;
    try {
        String path = "/material-design-icons/editor/drawable-xhdpi/ic_format_color_text_black_18dp.png";
        icon = new ImageIcon(App.class.getResource(path));
    } catch (NullPointerException ex) {
        System.out.println("Icon not found");
    }
    // Pidn labelu s ikonou a nastavm velikost psma
    label.gridy = 0;
    field.gridy = 0;
    JLabel nameLabel = new JLabel("Nzev: ", icon, JLabel.CENTER);
    nameLabel.setFont(nameLabel.getFont().deriveFont(App.FONT_SIZE * 2 / 3));
    panel.add(nameLabel, label);
    // Pole pro jmno
    final JTextField name = new JTextField();
    name.setMaximumSize(new Dimension(Integer.MAX_VALUE, 50));
    name.setFont(name.getFont().deriveFont(App.FONT_SIZE * 2 / 3));
    panel.add(name, field);

    // Pole pro zadn sdlenho hesla
    // Ikona
    icon = null;
    try {
        String path = "/material-design-icons/hardware/drawable-xhdpi/ic_security_black_18dp.png";
        icon = new ImageIcon(App.class.getResource(path));
    } catch (NullPointerException ex) {
        System.out.println("Icon not found");
    }
    // Pidn labelu s ikonou
    label.gridy = 1;
    field.gridy = 1;
    JLabel secretLabel = new JLabel("Heslo: ", icon, JLabel.CENTER);
    secretLabel.setFont(secretLabel.getFont().deriveFont(App.FONT_SIZE * 2 / 3));
    panel.add(secretLabel, label);
    // Pole pro heslo
    final JTextField secret = new JTextField();
    secret.setMaximumSize(new Dimension(Integer.MAX_VALUE, 50));
    secret.setFont(secret.getFont().deriveFont(App.FONT_SIZE * 2 / 3));
    panel.add(secret, field);

    this.setVisible(true);

    // Akce pro odesln formule
    ActionListener submit = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            submit(prop, name, secret, false);
        }
    };

    // Pi stisku klvesy Enter odele formul
    name.addActionListener(submit);
    secret.addActionListener(submit);
    // Pi zmn pole pro heslo se vstup okamit zformtuje
    final Runnable sanitizer = new Runnable() {
        @Override
        public void run() {
            sanitize(secret);

        }
    };
    secret.getDocument().addDocumentListener(new DocumentListener() {

        @Override
        public void removeUpdate(DocumentEvent e) {
        }

        @Override
        public void insertUpdate(DocumentEvent e) {
            SwingUtilities.invokeLater(sanitizer);
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
        }
    });

    // Pi zaven okna odele formul
    this.addWindowListener(new WindowListener() {

        @Override
        public void windowOpened(WindowEvent e) {
            // Ignorovat

        }

        @Override
        public void windowIconified(WindowEvent e) {
            // Ignorovat

        }

        @Override
        public void windowDeiconified(WindowEvent e) {
            // Ignorovat

        }

        @Override
        public void windowDeactivated(WindowEvent e) {
            // Ignorovat

        }

        @Override
        public void windowClosing(WindowEvent e) {
            // Odeslat
            submit(prop, name, secret, true);

        }

        @Override
        public void windowClosed(WindowEvent e) {
            // Ignorovat

        }

        @Override
        public void windowActivated(WindowEvent e) {
            // Ignorovat

        }
    });
}

From source file:es.emergya.ui.gis.popups.GenericDialog.java

public GenericDialog(T i, final String titulo, final String icon) {
    super();/*from  ww  w.  j a va  2s .  com*/
    log.trace("GenericDialog(" + i + ")");
    setAlwaysOnTop(true);
    setResizable(false);
    setBackground(Color.WHITE);
    setPreferredSize(new Dimension(500, 500));
    setTitle(titulo);
    try {
        setIconImage(((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame()
                .getIconImage());
    } catch (Throwable e) {
        LOG.error("There is no icon image", e);
    }
    JPanel base = new JPanel();
    base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS));
    base.setBackground(Color.WHITE);

    JPanel title = new JPanel(new FlowLayout(FlowLayout.LEADING));

    final JLabel labelTitle = new JLabel(titulo, LogicConstants.getIcon(icon), JLabel.LEFT);
    labelTitle.setFont(LogicConstants.deriveBoldFont(12f));

    title.setBackground(Color.WHITE);

    title.add(labelTitle);

    base.add(title);

    mid = new JPanel(new SpringLayout());
    mid.setBackground(Color.WHITE);

    loadDialog(i);

    SpringUtilities.makeCompactGrid(mid, rows, cols, initialX, initialY, xPad, yPad);
    base.add(mid);

    JPanel buttons = new JPanel();

    buttons.setBackground(Color.WHITE);
    JButton accept = new JButton(i18n.getString("Buttons.ok"), LogicConstants.getIcon("button_accept"));
    accept.addActionListener(closeListener);
    accept.addActionListener(saveListener);
    buttons.add(accept);

    JButton cancel = new JButton(i18n.getString("Buttons.cancel"), LogicConstants.getIcon("button_cancel"));
    cancel.addActionListener(closeListener);
    buttons.add(cancel);

    base.add(buttons);

    getContentPane().add(base);
    pack();

    int x;
    int y;

    Container myParent;
    try {
        myParent = ((BasicWindow) GoClassLoader.getGoClassLoader().load(BasicWindow.class)).getFrame()
                .getContentPane();
        java.awt.Point topLeft = myParent.getLocationOnScreen();
        Dimension parentSize = myParent.getSize();

        Dimension mySize = getSize();

        if (parentSize.width > mySize.width)
            x = ((parentSize.width - mySize.width) / 2) + topLeft.x;
        else
            x = topLeft.x;

        if (parentSize.height > mySize.height)
            y = ((parentSize.height - mySize.height) / 2) + topLeft.y;
        else
            y = topLeft.y;

        setLocation(x, y);
    } catch (Throwable e1) {
        LOG.error("There is no basic window!", e1);
    }
}

From source file:com.att.aro.ui.view.videotab.VideoTab.java

public JLabel getTitle() {
    JLabel VideoResultSummaryLabel = new JLabel(ResourceBundleHelper.getMessageString("videoSummary.title"));
    VideoResultSummaryLabel.setFont(new Font("HeaderFont", Font.BOLD, 18));
    return VideoResultSummaryLabel;
}

From source file:com.bsoft.baseframe.baseframe_utils.beanUtils.Classgenerator.java

/**
 * ???//from w w  w .  j a  v a2  s  .  co  m
 */
public Classgenerator() {
    setTitle("?");
    setSize(WIDTH, HEIGHT);
    setLocationRelativeTo(null);

    JPanel panel = new JPanel();
    panel.setLayout(new GridLayout(2, 1));

    JPanel _beanPanel = new JPanel();
    _beanPanel.setBorder(BorderFactory.createTitledBorder("?"));

    JPanel _otherPanel = new JPanel();
    _otherPanel.setBorder(BorderFactory.createTitledBorder("?"));

    JLabel _tbLabel = new JLabel("??*");
    _tb = new JTextField(25);
    _beanPanel.add(_tbLabel);
    _beanPanel.add(_tb);

    JLabel _stbbLabel = new JLabel("??*");
    _stb = new JTextField(25);
    _beanPanel.add(_stbbLabel);
    _beanPanel.add(_stb);

    JLabel _ibatisLabel = new JLabel("IBTS*");
    _ibatis = new JTextField(25);
    _beanPanel.add(_ibatisLabel);
    _beanPanel.add(_ibatis);

    JLabel _svLabel = new JLabel("SERVICE");
    _sv = new JTextField(23);
    _otherPanel.add(_svLabel);
    _otherPanel.add(_sv);

    //      JLabel _sviLabel = new JLabel("??*");
    //      _zwmc = new JTextField("?",25);
    //      _zwmc.setEditable(false);
    //      _otherPanel.add(_sviLabel);
    //      _otherPanel.add(_zwmc);

    JLabel _detail = new JLabel("(?ServiceService??,");
    JLabel _detail2 = new JLabel("??Service???.impl)");
    _detail.setFont(new Font("", Font.ITALIC, 12));
    _detail2.setFont(new Font("", Font.ITALIC, 12));
    _otherPanel.add(_detail);
    _otherPanel.add(_detail2);
    panel.add(_beanPanel);
    panel.add(_otherPanel);

    add(panel, BorderLayout.CENTER);

    JPanel btnPanel = new JPanel();
    JButton _saveBtn = new JButton("?");

    _saveBtn.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            int msg_code = clickSaveBtn(e);
            showMsg(msg_code);
        }
    });

    JButton _restBtn = new JButton("?");

    //?
    _restBtn.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            _tb.setText(null);
            _stb.setText(null);
            _ibatis.setText(null);
            _sv.setText(null);
            //            _svi.setText(null);
        }
    });
    btnPanel.add(_saveBtn);
    btnPanel.add(_restBtn);
    add(btnPanel, BorderLayout.SOUTH);
}