List of usage examples for java.awt.event ComponentAdapter ComponentAdapter
ComponentAdapter
From source file:jasmine.imaging.shapes.RadiusChart.java
public RadiusChart(Vector<Double> values) { super();//from w w w. j av a 2s.c o m DefaultCategoryDataset series = new DefaultCategoryDataset(); for (int i = 0; i < values.size(); i++) { series.addValue(values.elementAt(i), "row1", String.valueOf(i)); } setTitle("Radius Change"); chart = new JLabel(); getContentPane().add(chart); setSize(320, 240); setVisible(true); myChart = ChartFactory.createLineChart(null, null, null, series, PlotOrientation.VERTICAL, false, false, false); addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { if (myChart != null) updateChart(); } }); }
From source file:it.unibas.spicygui.controllo.datasource.ActionViewInstances.java
public ActionViewInstances() { executeInjection();/* w ww .jav a 2s . c om*/ componentAdapter = new ComponentAdapter() { @Override public void componentShown(ComponentEvent e) { InstancesTopComponent instancesTopComponent = (InstancesTopComponent) e.getComponent(); instancesTopComponent.setSplitPaneDivider(); } }; this.putValue(SHORT_DESCRIPTION, NbBundle.getMessage(Costanti.class, Costanti.ACTION_VIEW_INSTANCES_TOOLTIP)); this.setEnabled(false); registraAzione(); }
From source file:it.unibas.spicygui.vista.TGDTabbedPane.java
public TGDTabbedPane(FORule fORuleParameter, Scenario scenarioParameter, MappingTask mappingTask) { this.fORule = fORuleParameter; this.scenario = scenarioParameter; initComponents();//ww w .jav a 2 s. c o m initArea(fORuleParameter.toLogicalString(mappingTask)); this.setVisible(true); this.addComponentListener(new ComponentAdapter() { @Override public void componentShown(ComponentEvent e) { scenario.setSelectedFORule(fORule); scenario.setSelectedConstantFORule(null); scenario.getTGDCorrespondencesTopComponent().drawConnections(); } }); // creaPopUp(); }
From source file:misc.ShapedWindowDemo.java
public ShapedWindowDemo() { super("ShapedWindow"); setLayout(new GridBagLayout()); // It is best practice to set the window's shape in // the componentResized method. Then, if the window // changes size, the shape will be correctly recalculated. addComponentListener(new ComponentAdapter() { // Give the window an elliptical shape. // If the window is resized, the shape is recalculated here. @Override/*from w w w . j a v a 2 s . c om*/ public void componentResized(ComponentEvent e) { setShape(new Ellipse2D.Double(0, 0, getWidth(), getHeight())); } }); setUndecorated(true); setSize(300, 200); setLocationRelativeTo(null); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); add(new JButton("I am a Button")); }
From source file:org.optaplanner.examples.flightcrewscheduling.swingui.FlightCrewSchedulingWorldPanel.java
public FlightCrewSchedulingWorldPanel(FlightCrewSchedulingPanel flightCrewSchedulingPanel) { this.flightCrewSchedulingPanel = flightCrewSchedulingPanel; addComponentListener(new ComponentAdapter() { @Override/*from w w w . ja v a 2s. co m*/ public void componentResized(ComponentEvent e) { // TODO Not thread-safe during solving FlightCrewSolution solution = FlightCrewSchedulingWorldPanel.this.flightCrewSchedulingPanel .getSolution(); if (solution != null) { resetPanel(solution); } } }); }
From source file:com.anrisoftware.prefdialog.miscswing.twolayoutspanel.ChangeLayoutBasedOnWidthPanel.java
ChangeLayoutBasedOnWidthPanel() { this.panelSizeListener = new ComponentAdapter() { @Override// ww w. j a v a2 s . c om public void componentResized(ComponentEvent e) { updateLayout(); } }; }
From source file:jasmine.imaging.core.util.Histogram.java
public Histogram(Hashtable<Integer, Integer> count) { super("Histogram"); DefaultCategoryDataset series = new DefaultCategoryDataset(); StatisticsSolver solver = new StatisticsSolver(1000); for (int i = 0; i < 256; i++) { Integer value = count.get(i); if (value == null) value = 1;//from w w w . ja va 2s. co m for (int j = 0; j < value; j++) { solver.addData(i); } series.addValue(value, "row1", String.valueOf(i)); } setTitle("Histogram: v=" + solver.getStandardDeviation()); chart = new JLabel(); getContentPane().add(chart); setSize(320, 240); setVisible(true); myChart = ChartFactory.createLineChart(null, null, null, series, PlotOrientation.VERTICAL, false, false, false); //updateChart(); addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { if (myChart != null) updateChart(); } }); }
From source file:org.optaplanner.examples.coachshuttlegathering.swingui.CoachShuttleGatheringWorldPanel.java
public CoachShuttleGatheringWorldPanel(CoachShuttleGatheringPanel coachShuttleGatheringPanel) { this.coachShuttleGatheringPanel = coachShuttleGatheringPanel; addComponentListener(new ComponentAdapter() { @Override/*w w w. j a v a 2 s.c o m*/ public void componentResized(ComponentEvent e) { // TODO Not thread-safe during solving CoachShuttleGatheringSolution solution = CoachShuttleGatheringWorldPanel.this.coachShuttleGatheringPanel .getCoachShuttleGatheringSolution(); if (solution != null) { resetPanel(solution); } } }); }
From source file:org.optaplanner.examples.rocktour.swingui.RockTourWorldPanel.java
public RockTourWorldPanel(RockTourPanel rockTourPanel) { this.rockTourPanel = rockTourPanel; addComponentListener(new ComponentAdapter() { @Override// ww w. j a va 2 s . c om public void componentResized(ComponentEvent e) { // TODO Not thread-safe during solving RockTourSolution solution = RockTourWorldPanel.this.rockTourPanel.getSolution(); if (solution != null) { resetPanel(solution); } } }); }
From source file:com.gs.obevo.util.inputreader.DialogInputReader.java
@Override public String readPassword(String promptMessage) { final JPasswordField jpf = new JPasswordField(); JOptionPane jop = new JOptionPane(jpf, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION); JDialog dialog = jop.createDialog(promptMessage); dialog.addComponentListener(new ComponentAdapter() { @Override//www.j a v a2 s . c o m public void componentShown(ComponentEvent e) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { jpf.requestFocusInWindow(); } }); } }); dialog.setVisible(true); int result = (Integer) jop.getValue(); dialog.dispose(); String password = null; if (result == JOptionPane.OK_OPTION) { password = new String(jpf.getPassword()); } if (StringUtils.isEmpty(password)) { return null; } else { return password; } }