Java Code Examples for java.awt.event.ComponentEvent

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project autopsy, under directory /Core/src/org/sleuthkit/autopsy/ingest/.

Source file: IngestMessageMainPanel.java

  19 
vote

private void customizeComponents(){
  messagePanel=new IngestMessagePanel(this);
  detailsPanel=new IngestMessageDetailsPanel(this);
  this.addComponentListener(new ComponentListener(){
    @Override public void componentHidden(    ComponentEvent e){
    }
    @Override public void componentMoved(    ComponentEvent e){
    }
    @Override public void componentShown(    ComponentEvent e){
    }
    @Override public void componentResized(    ComponentEvent e){
      doResize();
    }
  }
);
  messagePanel.setOpaque(true);
  detailsPanel.setOpaque(true);
  add(messagePanel,JLayeredPane.PALETTE_LAYER);
  add(detailsPanel,JLayeredPane.DEFAULT_LAYER);
  this.setOpaque(true);
}
 

Example 2

From project Briss, under directory /src/main/java/at/laborg/briss/.

Source file: BrissGUI.java

  19 
vote

@Override public void componentResized(ComponentEvent e){
  previewPanel.revalidate();
  for (  Component component : previewPanel.getComponents()) {
    component.repaint();
  }
}
 

Example 3

From project ceres, under directory /ceres-ui/src/main/java/com/bc/ceres/swing/figure/support/.

Source file: FigureEditorPanel.java

  19 
vote

public FigureEditorPanel(UndoContext undoContext,FigureCollection figureCollection,FigureFactory figureFactory){
  super(null);
  setFocusable(true);
  setRequestFocusEnabled(true);
  setBackground(Color.WHITE);
  this.figureCollection=figureCollection;
  this.viewport=new DefaultViewport(true);
  this.figureEditor=new DefaultFigureEditor(this,this.viewport,undoContext,figureCollection,figureFactory);
  rendering=new DefaultRendering(this.viewport);
  addComponentListener(new ComponentAdapter(){
    @Override public void componentResized(    ComponentEvent e){
      viewport.setViewBounds(getBounds());
    }
  }
);
  viewport.addListener(new ViewportListener(){
    @Override public void handleViewportChanged(    Viewport viewport,    boolean orientationChanged){
      repaint();
    }
  }
);
}
 

Example 4

From project contribution_eevolution_smart_browser, under directory /client/src/org/compiere/apps/.

Source file: WindowManager.java

  19 
vote

public void componentHidden(ComponentEvent e){
  Component c=e.getComponent();
  if (c instanceof CFrame) {
    c.removeComponentListener(this);
    ((CFrame)c).removeWindowListener(this);
    windowManager.remove((CFrame)c);
  }
}
 

Example 5

From project dnieprov, under directory /src/org/dnieprov/driver/.

Source file: PasswordGuiCallback.java

  19 
vote

@Override public char[] getPassword(String title,String msg) throws DnieUnexpectedException {
  final JPasswordField jpf=new JPasswordField();
  JOptionPane jop=new JOptionPane(new Object[]{new JLabel("<HTML>" + msg + "<HTML>"),jpf},JOptionPane.QUESTION_MESSAGE,JOptionPane.OK_CANCEL_OPTION);
  JDialog dialog=jop.createDialog(title);
  dialog.setAlwaysOnTop(true);
  dialog.addComponentListener(new ComponentAdapter(){
    @Override public void componentShown(    ComponentEvent e){
      SwingUtilities.invokeLater(new Runnable(){
        @Override public void run(){
          jpf.requestFocusInWindow();
        }
      }
);
    }
  }
);
  dialog.setVisible(true);
  if (jop.getValue() == null) {
    return null;
  }
  int result=(Integer)jop.getValue();
  dialog.dispose();
  if (result == JOptionPane.OK_OPTION) {
    return jpf.getPassword();
  }
  return null;
}
 

Example 6

From project drools-planner, under directory /drools-planner-examples/src/main/java/org/drools/planner/examples/tsp/swingui/.

Source file: TspWorldPanel.java

  19 
vote

public TspWorldPanel(TspPanel tspPanel){
  this.tspPanel=tspPanel;
  addComponentListener(new ComponentAdapter(){
    @Override public void componentResized(    ComponentEvent e){
      TravelingSalesmanTour travelingSalesmanTour=TspWorldPanel.this.tspPanel.getTravelingSalesmanTour();
      if (travelingSalesmanTour != null) {
        resetPanel(travelingSalesmanTour);
      }
    }
  }
);
  addMouseListener(new MouseAdapter(){
    @Override public void mousePressed(    MouseEvent e){
      if (translator != null) {
        double longitude=translator.translateXToLongitude(e.getX());
        double latitude=translator.translateYToLatitude(e.getY());
        TspWorldPanel.this.tspPanel.insertCityAndVisit(longitude,latitude);
      }
    }
  }
);
  europaBackground=new ImageIcon(getClass().getResource("/org/drools/planner/examples/tsp/swingui/europaBackground.png"));
}
 

Example 7

From project drugis-common, under directory /common-gui/src/main/java/org/drugis/common/gui/table/.

Source file: TablePanel.java

  19 
vote

private JPanel createPanel(final JTable table){
  JPanel panel=new JPanel(new FlowLayout(FlowLayout.LEFT));
  final JScrollPane sp=new JScrollPane(table);
  sp.setBorder(BorderFactory.createEmptyBorder());
  sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
  sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
  panel.add(sp);
  final ComponentAdapter scrollPaneSizer=new ComponentAdapter(){
    @Override public void componentResized(    ComponentEvent e){
      final int padding=2;
      final int margin=50;
      if (findParent() == null) {
        return;
      }
      int tablewidth=table.getPreferredSize().width + padding;
      int panelwidth=findParent().getSize().width - margin;
      int headerHeight=0;
      if (table.getTableHeader() != null) {
        headerHeight=table.getTableHeader().getHeight();
      }
      int height=table.getPreferredSize().height + sp.getHorizontalScrollBar().getHeight() + headerHeight+ padding;
      sp.setPreferredSize(new Dimension(Math.min(tablewidth,panelwidth),height));
      sp.revalidate();
    }
  }
;
  table.addComponentListener(scrollPaneSizer);
  this.addHierarchyListener(new HierarchyListener(){
    public void hierarchyChanged(    HierarchyEvent e){
      if (findParent() != null) {
        findParent().addComponentListener(scrollPaneSizer);
      }
    }
  }
);
  return panel;
}
 

Example 8

From project Euclidean-Pattern-Generator, under directory /src/com/hisschemoller/sequencer/view/components/.

Source file: MainFrame.java

  19 
vote

private void setPreferences(ComponentEvent event){
  EPGPreferences.putInt(EPGPreferences.WINDOW_X,event.getComponent().getX());
  EPGPreferences.putInt(EPGPreferences.WINDOW_Y,event.getComponent().getY());
  EPGPreferences.putInt(EPGPreferences.WINDOW_WIDTH,event.getComponent().getWidth());
  EPGPreferences.putInt(EPGPreferences.WINDOW_HEIGHT,event.getComponent().getHeight());
}
 

Example 9

From project flyingsaucer, under directory /flying-saucer-core/src/main/java/org/xhtmlrenderer/simple/.

Source file: FSScrollPane.java

  19 
vote

/** 
 * Adds a component listener on the view for resize events, to adjust the scroll increment. 
 */
private void addResizeListener(Component view){
  view.addComponentListener(new ComponentAdapter(){
    /** 
 * Invoked when the component's size changes. Reset scrollable increment, because page-down/up is relative to current view size.
 */
    public void componentResized(    ComponentEvent e){
      JScrollBar bar=getVerticalScrollBar();
      int incr=(int)(getSize().getHeight() - (bar.getUnitIncrement(1) * 3));
      getVerticalScrollBar().setBlockIncrement(incr);
    }
  }
);
}
 

Example 10

From project formic, under directory /src/java/net/java/swingfx/waitwithstyle/.

Source file: SingleComponentInfiniteProgress.java

  19 
vote

public void componentResized(final ComponentEvent e){
  if (useBackBuffer == true) {
    setOpaque(false);
    imageBuf=null;
    timerTask.iterate=3;
  }
}
 

Example 11

From project GAIL, under directory /src/gail/grid/.

Source file: Grid.java

  19 
vote

/** 
 * Create a 2D grid with the size passed as parameters.
 * @param horizCellNumber
 * @param vertCellNumber 
 */
public Grid(int horizCellNumber,int vertCellNumber){
  this.horizCellNumber=horizCellNumber;
  this.vertCellNumber=vertCellNumber;
  this.setLayout(null);
  this.addComponentListener(new ComponentAdapter(){
    @Override public void componentResized(    ComponentEvent e){
      pauseRunningAnimations();
      layComponents();
      cancelRunningAnimations();
    }
  }
);
  overlayStrokes=new LinkedList<OverlayStroke>();
}
 

Example 12

From project Gmote, under directory /gmoteserver/src/org/gmote/server/.

Source file: PasswordSettingsUi.java

  19 
vote

/** 
 * This method initializes jFrame
 * @return true if the OK button was pressed.
 */
public boolean showFrame(){
  ComponentAdapter adapter=new ComponentAdapter(){
    @Override public void componentShown(    ComponentEvent e){
      jPasswordField.requestFocusInWindow();
    }
  }
;
  jDialog=new PasswordDialog(null,true);
  jDialog.addComponentListener(adapter);
  jDialog.setSize(new Dimension(460,166));
  jDialog.setTitle("Change Password");
  jDialog.setContentPane(getJDesktopPane());
  jDialog.getRootPane().setDefaultButton(getCmdOk());
  getJDesktopPane().setFocusable(true);
  getJDesktopPane().requestFocusInWindow();
  getJDesktopPane().setBackground(UIManager.getColor("window"));
  jDialog.setVisible(true);
  return result;
}
 

Example 13

From project grid-goggles, under directory /Dependent Libraries/controlP5/src/controlP5/.

Source file: PAppletWindow.java

  19 
vote

public void componentMoved(ComponentEvent e){
  Component c=e.getComponent();
  x=c.getLocation().x;
  y=c.getLocation().y;
  updateTitle();
}
 

Example 14

From project Haven-and-Hearth-client-modified-by-Ender, under directory /src/haven/.

Source file: MainFrame.java

  19 
vote

public void run(){
  addWindowListener(new WindowAdapter(){
    public void windowClosing(    WindowEvent e){
      g.interrupt();
    }
  }
);
  addComponentListener(new ComponentAdapter(){
    public void componentResized(    ComponentEvent evt){
      innerSize.setSize(getWidth() - insetsSize.width,getHeight() - insetsSize.height);
      centerPoint.setLocation(innerSize.width / 2,innerSize.height / 2);
    }
  }
);
  Thread ui=new HackThread(p,"Haven UI thread");
  p.setfsm(this);
  ui.start();
  try {
    while (true) {
      Bootstrap bill=new Bootstrap();
      if (Config.defserv != null)       bill.setaddr(Config.defserv);
      if ((Config.authuser != null) && (Config.authck != null)) {
        bill.setinitcookie(Config.authuser,Config.authck);
        Config.authck=null;
      }
      Session sess=bill.run(p);
      RemoteUI rui=new RemoteUI(sess);
      rui.run(p.newui(sess));
    }
  }
 catch (  InterruptedException e) {
  }
 finally {
    ui.interrupt();
    dispose();
  }
}
 

Example 15

From project Holo-Edit, under directory /holoedit/gui/.

Source file: RoomGUI.java

  19 
vote

public void componentResized(ComponentEvent e){
  sizW=this.getWidth();
  sizH=this.getHeight();
  int w=sizW;
  int h=sizH - (W_TIME_SCALE_MARGIN + H_BLANK_ZONE + H_TIME_SCALE);
  int glpSize=Math.min(Math.max(w,h),750);
  sizW=glpSize;
  sizH=glpSize + (W_TIME_SCALE_MARGIN + H_BLANK_ZONE + H_TIME_SCALE);
  proj_glp.scalescrollGUIdirty=true;
  setSize(sizW,sizH);
}
 

Example 16

From project ideavim, under directory /src/com/maddyhome/idea/vim/ui/.

Source file: ExEntryPanel.java

  19 
vote

private ExEntryPanel(){
  setBorder(BorderFactory.createEtchedBorder());
  Font font=new Font("Monospaced",Font.PLAIN,12);
  label=new JLabel(" ");
  label.setFont(font);
  entry=new ExTextField();
  entry.setFont(font);
  entry.setBorder(null);
  setForeground(entry.getForeground());
  setBackground(entry.getBackground());
  label.setForeground(entry.getForeground());
  label.setBackground(entry.getBackground());
  GridBagLayout layout=new GridBagLayout();
  GridBagConstraints gbc=new GridBagConstraints();
  setLayout(layout);
  gbc.gridx=0;
  layout.setConstraints(this.label,gbc);
  add(this.label);
  gbc.gridx=1;
  gbc.weightx=1.0;
  gbc.fill=GridBagConstraints.HORIZONTAL;
  layout.setConstraints(entry,gbc);
  add(entry);
  setBorder(BorderFactory.createLineBorder(Color.BLACK));
  adapter=new ComponentAdapter(){
    public void componentResized(    ComponentEvent e){
      positionPanel();
    }
  }
;
}
 

Example 17

From project JaamSim, under directory /com/sandwell/JavaSimulation3D/.

Source file: Sim3DWindow.java

  19 
vote

public void componentMoved(ComponentEvent e){
  Sim3DWindow win=(Sim3DWindow)e.getSource();
  if (win.interactiveLocationChange) {
    win.behavior.updateBehaviour();
    win.behavior.storeUndoSteps();
    win.region.updateWindowPosInput();
  }
 else {
    win.interactiveLocationChange=true;
  }
}
 

Example 18

From project jftp, under directory /src/main/java/com/myjavaworld/jftp/.

Source file: FTPSession.java

  19 
vote

public FTPSession(JFTP jftp){
  super();
  this.jftp=jftp;
  this.id=++sessionId;
  setName("cmd.session" + id);
  updateTitle();
  localFileFilter=new LocalFileFilter(null,null,false);
  connectStatusFormat=new MessageFormat(resources.getString("status.connect"));
  downloadStatusFormat=new MessageFormat(resources.getString("status.download"));
  uploadStatusFormat=new MessageFormat(resources.getString("status.upload"));
  listStatusFormat=new MessageFormat(resources.getString("status.list"));
  listParentStatus=resources.getString("status.listParent");
  timer=new Timer(1000,this);
  getContentPane().setLayout(new BorderLayout(0,0));
  getContentPane().add(getCenterPanel(),BorderLayout.CENTER);
  getContentPane().add(getSouthPanel(),BorderLayout.SOUTH);
  File lwd=new File(JFTP.prefs.getLocalDirectory());
  if (!lwd.exists() || !lwd.isDirectory()) {
    lwd=FileSystemView.getFileSystemView().getDefaultDirectory();
  }
  setLocalWorkingDirectory(new LocalFile(lwd));
  addComponentListener(new ComponentAdapter(){
    @Override public void componentShown(    ComponentEvent arg0){
      splitPane1.setDividerLocation(0.5);
      splitPane2.setDividerLocation(0.2);
    }
  }
);
  fileChangeMonitor=new FileChangeMonitor();
  fileChangeMonitor.addFileChangeListener(this);
  monitoredTransfers=new Hashtable();
  zipStatusFormat=new MessageFormat(resources.getString("status.zip"));
  unzipStatusFormat=new MessageFormat(resources.getString("status.unzip"));
  progressTimer=new Timer(1000,this);
}
 

Example 19

From project jgraphx, under directory /examples/com/mxgraph/examples/swing/editor/.

Source file: BasicGraphEditor.java

  19 
vote

/** 
 */
public EditorPalette insertPalette(String title){
  final EditorPalette palette=new EditorPalette();
  final JScrollPane scrollPane=new JScrollPane(palette);
  scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
  scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  libraryPane.add(title,scrollPane);
  libraryPane.addComponentListener(new ComponentAdapter(){
    /** 
 */
    public void componentResized(    ComponentEvent e){
      int w=scrollPane.getWidth() - scrollPane.getVerticalScrollBar().getWidth();
      palette.setPreferredWidth(w);
    }
  }
);
  return palette;
}
 

Example 20

From project jMemorize, under directory /src/jmemorize/gui/swing/panels/.

Source file: DeckChartPanel.java

  19 
vote

private void initComponents(){
  m_chartPanel=new ChartPanel(createChart());
  m_chartPanel.addChartMouseListener(new MouseClicked());
  m_chartPanel.setMinimumDrawHeight(100);
  m_chartPanel.setMinimumDrawWidth(400);
  m_chartPanel.setMaximumDrawHeight(1600);
  m_chartPanel.setMaximumDrawWidth(10000);
  setLayout(new BorderLayout());
  setBorder(new EmptyBorder(10,2,2,2));
  add(m_chartPanel);
  addComponentListener(new ComponentAdapter(){
    public void componentResized(    ComponentEvent e){
      if (m_category != null)       updateBars();
    }
  }
);
}
 

Example 21

From project jupload, under directory /src/wjhk/jupload2/gui/.

Source file: PicturePanel.java

  19 
vote

/** 
 * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
 */
public void componentResized(@SuppressWarnings("unused") ComponentEvent arg0){
  this.uploadPolicy.displayDebug("Within componentResized",60);
  if (this.offscreenImage != null) {
    this.offscreenImage.flush();
    this.offscreenImage=null;
  }
  calculateOffscreenImage();
  repaint();
}
 

Example 22

From project JVerge, under directory /src/core/.

Source file: GUI.java

  19 
vote

public void componentResized(ComponentEvent e){
  Dimension scrsize=Toolkit.getDefaultToolkit().getScreenSize();
  winwidth=scrsize.width;
  winheight=scrsize.height;
  updateCanvasSize();
}
 

Example 23

From project KindleTERM, under directory /src/j2me/awt/.

Source file: AwtTerminal.java

  19 
vote

/** 
 * @param buffer
 */
public AwtTerminal(VT320 buffer,AwtSession session){
  this.buffer=buffer;
  buffer.setDisplay(this);
  rotated=ROT_NORMAL;
  initFont();
  this.session=session;
  this.addComponentListener(new ComponentAdapter(){
    public void componentResized(    ComponentEvent e){
      sizeChanged();
      redraw();
    }
  }
);
  this.prevCursorX=buffer.cursorX;
  this.prevCursorY=buffer.cursorY;
  this.addKeyListener(this);
  setBackground(bgcolor);
  sizeChanged();
  for (int d=0; d < dirtyRects.length; d++)   dirtyRects[d]=new Rectangle();
}
 

Example 24

From project knime-scripting, under directory /matlab4knime/src/de/mpicbg/tds/knime/scripting/matlab/plots/.

Source file: MatlabPlotCanvas.java

  19 
vote

public MatlabPlotCanvas(MatlabPlotNodeModel plotModel){
  setFocusable(true);
  setPreferredSize(new Dimension(plotModel.getDefWidth(),plotModel.getDefHeight()));
  this.plotModel=plotModel;
  baseImage=toBufferedImage(plotModel.getImage());
  addComponentListener(new ComponentAdapter(){
    @Override public void componentResized(    ComponentEvent e){
      if (!isVisible()) {
        return;
      }
      BufferedImage bufImage=new BufferedImage(getWidth(),getHeight(),BufferedImage.TYPE_INT_RGB);
      Graphics2D g=bufImage.createGraphics();
      AffineTransform at=AffineTransform.getScaleInstance((double)getWidth() / baseImage.getWidth(null),(double)getHeight() / baseImage.getHeight(null));
      AffineTransformOp op=new AffineTransformOp(at,AffineTransformOp.TYPE_BILINEAR);
      scaledImage=op.filter(baseImage,null);
    }
  }
);
  addKeyListener(new KeyAdapter(){
    public void keyPressed(    KeyEvent e){
      if (e.getKeyCode() == KeyEvent.VK_C && e.isMetaDown())       new ImageClipper().copyToClipboard(MatlabPlotCanvas.this.baseImage);
    }
  }
);
}
 

Example 25

From project leaves, under directory /libraries/controlP5/src/controlP5/.

Source file: PAppletWindow.java

  19 
vote

public void componentMoved(ComponentEvent e){
  Component c=e.getComponent();
  x=c.getLocation().x;
  y=c.getLocation().y;
  updateTitle();
}
 

Example 26

From project lilith, under directory /lilith/src/main/java/de/huxhorn/lilith/swing/.

Source file: ProgressGlassPane.java

  19 
vote

public ProgressGlassPane(){
  super(new GridBagLayout());
  MouseEventEater eater=new MouseEventEater();
  setOpaque(false);
  GridBagConstraints gbc=new GridBagConstraints();
  gbc.insets=new Insets(5,5,5,5);
  JLabel searchLabel=new JLabel("Searching...");
  gbc.gridx=0;
  gbc.gridy=0;
  add(searchLabel,gbc);
  progressBar=new JProgressBar(JProgressBar.HORIZONTAL,0,100);
  progressBar.setStringPainted(true);
  gbc.gridy=1;
  add(progressBar,gbc);
  cancelAction=new CancelAction();
  cancelButton=new JButton(cancelAction);
  gbc.gridy=2;
  add(cancelButton,gbc);
  addKeyListener(new KeyAdapter(){
  }
);
  addComponentListener(new ComponentAdapter(){
    public void componentShown(    ComponentEvent e){
      cancelButton.requestFocusInWindow();
    }
  }
);
  setFocusTraversalKeysEnabled(false);
  KeyStrokes.registerCommand(this,cancelAction,"CANCEL_ACTION");
  addMouseListener(eater);
  addMouseMotionListener(eater);
}
 

Example 27

From project Maimonides, under directory /src/com/codeko/apps/maimonides/horarios/.

Source file: PanelVisionHorario.java

  19 
vote

private void init(){
  scroll.setColumnHeaderView(cab);
  scroll.setRowHeaderView(lat);
  JLabel l=new JLabel("D?a");
  l.setBorder(BorderFactory.createLineBorder(Color.black));
  l.setHorizontalAlignment(SwingConstants.CENTER);
  l.setFont(l.getFont().deriveFont(Font.BOLD));
  l.setFont(l.getFont().deriveFont(12f));
  scroll.setCorner(ScrollPaneConstants.UPPER_LEFT_CORNER,l);
  for (int hora=0; hora < HORAS_DIA; hora++) {
    ArrayList<PanelCeldaHorario> v=new ArrayList<PanelCeldaHorario>();
    for (int dia=0; dia < DIAS_SEMANA; dia++) {
      PanelCeldaHorario p=new PanelCeldaHorario(this,dia + 1,hora + 1);
      pDatos.add(p);
      v.add(p);
    }
    getDatos().add(v);
  }
  pDatos.addComponentListener(new ComponentAdapter(){
    @Override public void componentResized(    ComponentEvent e){
      refrescarScroll();
    }
  }
);
}
 

Example 28

From project medsavant, under directory /medsavant/MedSavantClient/src/org/ut/biolab/medsavant/view/genetics/.

Source file: GenomeContainer.java

  19 
vote

public GenomeContainer(String pageName,Chromosome[] g){
  this.pageName=pageName;
  this.setLayout(new GridBagLayout());
  GridBagConstraints gbc=new GridBagConstraints();
  gbc.gridx=0;
  gbc.gridy=0;
  gbc.gridwidth=1;
  gbc.gridheight=1;
  gbc.fill=GridBagConstraints.BOTH;
  gbc.weightx=1.0;
  gbc.weighty=1.0;
  chrPlusButtonContainer=new JPanel();
  chrPlusButtonContainer.setLayout(new BorderLayout());
  chrContainer=ViewUtil.getClearPanel();
  chrContainer.setBorder(ViewUtil.getBigBorder());
  chrContainer.setLayout(new BoxLayout(chrContainer,BoxLayout.X_AXIS));
  chrPlusButtonContainer.add(chrContainer,BorderLayout.CENTER);
  add(chrPlusButtonContainer,gbc,JLayeredPane.DEFAULT_LAYER);
  waitPanel=new WaitPanel("Generating Genome View");
  add(waitPanel,gbc,JLayeredPane.PALETTE_LAYER);
  init=true;
  genome=g;
  setChromosomeViews();
  updateIfRequired();
  addComponentListener(new ComponentAdapter(){
    @Override public void componentShown(    ComponentEvent ce){
      updateIfRequired();
    }
    @Override public void componentHidden(    ComponentEvent ce){
      if (gnv != null && !gnv.isDone()) {
        gnv.cancel(true);
      }
    }
  }
);
}
 

Example 29

From project movsim, under directory /viewer/src/main/java/org/movsim/viewer/ui/.

Source file: AppFrame.java

  19 
vote

public AppFrame(ResourceBundle resourceBundle,ProjectMetaData projectMetaData,Properties properties){
  super(resourceBundle.getString("FrameName"));
  SwingHelper.activateWindowClosingAndSystemExitButton(this);
  final Simulator simulator=new Simulator(projectMetaData);
  initLookAndFeel();
  final TrafficCanvas trafficCanvas=new TrafficCanvas(simulator,properties);
  canvasPanel=new CanvasPanel(resourceBundle,trafficCanvas);
  statusPanel=new StatusPanel(resourceBundle,simulator);
  toolBar=new MovSimToolBar(statusPanel,trafficCanvas,resourceBundle);
  addMenu(resourceBundle,simulator,trafficCanvas,properties);
  add(canvasPanel,BorderLayout.CENTER);
  add(toolBar,BorderLayout.NORTH);
  addComponentListener(new ComponentAdapter(){
    @Override public void componentResized(    ComponentEvent e){
      canvasPanel.resized();
      canvasPanel.repaint();
    }
  }
);
  initFrameSize(properties);
  String projectName=projectMetaData.getProjectName();
  if (projectName.equals("")) {
    projectName="ramp_metering";
    trafficCanvas.setupTrafficScenario(projectName,"../sim/games/");
  }
 else {
    trafficCanvas.setupTrafficScenario(projectName,projectMetaData.getPathToProjectXmlFile());
  }
  statusPanel.reset();
  trafficCanvas.start();
  setVisible(true);
  boolean isGame=Boolean.parseBoolean(properties.getProperty("isGame"));
  if (isGame) {
    HighscoreFrame.initialize(resourceBundle,simulator,properties);
  }
}
 

Example 30

From project OMS3, under directory /src/main/java/ngmfconsole/.

Source file: JPanelButton.java

  19 
vote

private Container createWindow(){
  Component root=SwingUtilities.getRoot(this);
  final JDialog win=new JDialog((Window)root);
  win.setUndecorated(true);
  ComponentListener cl=new ComponentAdapter(){
    @Override public void componentMoved(    ComponentEvent e){
      if (isSelected()) {
        adjustWindow(win);
      }
    }
  }
;
  root.addComponentListener(cl);
  win.getContentPane().add(windowPanel);
  win.setFocusable(true);
  win.pack();
  return win;
}
 

Example 31

From project org.openscada.external, under directory /org.eclipse.albireo/src/org/eclipse/albireo/core/.

Source file: SwingControl.java

  19 
vote

protected void initFirstResizeActions(){
  this.frame.addComponentListener(new ComponentAdapter(){
    @Override public void componentResized(    final ComponentEvent e){
      scrollTextFields(SwingControl.this.frame);
      SwingControl.this.frame.removeComponentListener(this);
    }
  }
);
}
 

Example 32

From project packetsamurai, under directory /src/com/l2j/packetsamurai/gui/logrepo/.

Source file: LogFilesTab.java

  19 
vote

public void componentShown(ComponentEvent e){
synchronized (this) {
    LogRepository.getInstance();
    if (!_localLoaded) {
      Thread t=new Thread(){
        public void run(){
          LogRepository.getInstance().refreshLocalLogs();
          LogFilesTab.this.showLocalLogs();
          _localLoaded=true;
        }
      }
;
      t.start();
    }
    if (RemoteLogRepositoryBackend.getInstance().isConnected() && !_remoteLoaded) {
      Thread t=new Thread(){
        public void run(){
          LogRepository.getInstance().refreshRemoteLogs();
          _remoteLoaded=true;
        }
      }
;
      t.start();
    }
  }
}
 

Example 33

From project parasim, under directory /extensions/visualisation-plot-impl/src/main/java/org/sybila/parasim/visualisation/plot/impl/gui/.

Source file: Canvas.java

  19 
vote

/** 
 * Create new canvas with given point appearance.
 * @param renderer Class handling point appearance.
 */
public Canvas(PointRenderer renderer){
  render=renderer;
  setBorder(new LineBorder(Color.BLACK));
  addComponentListener(new ComponentAdapter(){
    @Override public void componentResized(    ComponentEvent e){
      if (points != null) {
        refreshFactors();
      }
      repaint();
    }
  }
);
}
 

Example 34

From project pings, under directory /client/.

Source file: PingsGUI.java

  19 
vote

public void componentResized(ComponentEvent e){
  ping_globe.forceRefresh();
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      setLayout();
    }
  }
);
}
 

Example 35

From project Pipeline, under directory /src/gui/figure/.

Source file: Figure.java

  19 
vote

public void componentResized(ComponentEvent arg0){
  currentX=getWidth();
  currentY=getHeight();
  for (  Object element : elements) {
    ((FigureElement)element).setScale(currentX,currentY,this.getGraphics());
  }
}
 

Example 36

From project pomodoro4nb, under directory /src/org/matveev/pomodoro4nb/task/.

Source file: TaskController.java

  19 
vote

private JScrollPane createTaskTablePanel(){
  final JScrollPane scrollPane=new JScrollPane(taskTable,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  scrollPane.addComponentListener(new ComponentAdapter(){
    @Override public void componentResized(    ComponentEvent e){
      setPreferredTableColumnWidths(e.getComponent().getSize(),taskTable,new double[]{0.5,0.1,0.1,0.1,0.1});
      taskTable.revalidate();
      taskTable.repaint();
    }
  }
);
  scrollPane.addMouseListener(new PopupListener(popupMenu));
  registerShortCuts(scrollPane);
  return scrollPane;
}
 

Example 37

From project project_bpm, under directory /Processing/libraries/controlP5/src/controlP5/.

Source file: PAppletWindow.java

  19 
vote

public void componentMoved(ComponentEvent e){
  Component c=e.getComponent();
  x=c.getLocation().x;
  y=c.getLocation().y;
  updateTitle();
}
 

Example 38

From project scisoft-ui, under directory /uk.ac.diamond.scisoft.analysis.rcp/src/uk/ac/diamond/scisoft/analysis/rcp/plotting/.

Source file: DataSetPlotter.java

  19 
vote

@Override public void componentResized(ComponentEvent arg0){
  if (plotter != null) {
    Component comp=((ViewerApp)viewerApp).getViewingComponent();
    plotter.notifyComponentResize(comp.getWidth(),comp.getHeight());
  }
}
 

Example 39

From project ScissLib, under directory /src/main/java/de/sciss/app/.

Source file: DynamicAncestorAdapter.java

  19 
vote

/** 
 * Constructs a new <code>DynamicAncestorAdapter</code> which will inform the <code>DynamicListening</code> about changes in visibility of the ancestor window of the component to which this adapter is added.
 * @param listener	a <code>DynamicListening</code>whose <code>startListening</code> method is called when this adapter's host component's ancestor is shown or added to another component. the listener's <code>stopListening</code> method is called likewise when this adapter's host component's ancestor is hidden or removed from its parent.
 */
public DynamicAncestorAdapter(DynamicListening listener){
  dynL=listener;
  winL=new WindowAdapter(){
    public void windowOpened(    WindowEvent e){
      if (EventManager.DEBUG_EVENTS) {
        System.err.println("windowOpened() : " + e.getWindow().getClass().getName());
      }
      if (!listening)       startListening();
    }
    public void windowClosed(    WindowEvent e){
      if (EventManager.DEBUG_EVENTS) {
        System.err.println("windowClosed() : " + e.getWindow().getClass().getName());
      }
      if (listening)       stopListening();
    }
  }
;
  cmpL=new ComponentAdapter(){
    public void componentShown(    ComponentEvent e){
      if (EventManager.DEBUG_EVENTS) {
        System.err.println("componentShown() : " + e.getComponent().getClass().getName());
      }
      if (!listening)       startListening();
    }
    public void componentHidden(    ComponentEvent e){
      if (EventManager.DEBUG_EVENTS) {
        System.err.println("componentHidden() : " + e.getComponent().getClass().getName());
      }
      if (listening)       stopListening();
    }
  }
;
}
 

Example 40

From project sikuli, under directory /extensions/guide/src/main/java/org/sikuli/guide/.

Source file: ClickRecorder.java

  19 
vote

@Override public void componentHidden(ComponentEvent e){
  Timer doScreenCaptureLater=new Timer(1000,new ActionListener(){
    @Override public void actionPerformed(    ActionEvent arg0){
      if (isCapturePending) {
        BufferedImage image=s.capture(region).getImage();
        currentClickEvent.setScreenImage(image);
        isCapturePending=false;
        setVisible(true);
      }
    }
  }
);
  doScreenCaptureLater.setRepeats(false);
  doScreenCaptureLater.start();
}
 

Example 41

From project SPREAD, under directory /src/colorpicker/plaf/.

Source file: ColorPickerSliderUI.java

  19 
vote

public ColorPickerSliderUI(JSlider b,ColorPicker cp){
  super(b);
  colorPicker=cp;
  cp.getColorPanel().addComponentListener(new ComponentAdapter(){
    public void componentResized(    ComponentEvent e){
      ColorPickerSliderUI.this.calculateGeometry();
      slider.repaint();
    }
  }
);
}
 

Example 42

From project SwingOSC, under directory /src/main/java/de/sciss/swingosc/.

Source file: ComponentResponder.java

  19 
vote

private void reply(String stateName,ComponentEvent e){
  Rectangle b=e.getComponent().getBounds();
  try {
    if (absCoords) {
      final Container cp=SwingUtilities.getRootPane(e.getComponent()).getContentPane();
      b=GUIUtil.convertRectangle(e.getComponent(),b,cp);
    }
    replyArgs[1]=stateName;
    replyArgs[2]=new Integer(b.x);
    replyArgs[3]=new Integer(b.y);
    replyArgs[4]=new Integer(b.width);
    replyArgs[5]=new Integer(b.height);
    client.reply(new OSCMessage(getOSCCommand(),replyArgs));
  }
 catch (  IOException ex) {
    SwingOSC.printException(ex,getOSCCommand());
  }
}
 

Example 43

From project thinklab, under directory /plugins/org.integratedmodelling.thinklab.thinkscape/src/org/integratedmodelling/thinkscape/.

Source file: ThinkScapeGUI.java

  19 
vote

/** 
 * This method initializes tgPanel
 * @return com.touchgraph.graphlayout.TGPanel
 */
public GrOWLDisplay getDisplay(){
  if (display == null) {
    display=new GrOWLDisplay();
    display.initPrefuse();
    display.setLayout(null);
    display.add(getNavToolBar(),null);
    display.setPreferredSize(new java.awt.Dimension(500,500));
    display.setSize(500,500);
    display.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray,1));
    display.addComponentListener(new ComponentAdapter(){
      public void componentResized(      ComponentEvent e){
        centerDisplay();
      }
    }
);
  }
  return display;
}
 

Example 44

From project TransFile, under directory /src/net/sourceforge/transfile/ui/swing/.

Source file: SwingGUI.java

  19 
vote

/** 
 * Enforces the window's maximum size
 */
private void enforceMaximumSize(){
  this.addComponentListener(new ComponentAdapter(){
    /** 
 * {@inheritDoc}
 */
    @Override public void componentResized(    final ComponentEvent event){
      if (SwingGUI.this.getSize().height > SwingGUI.this.getMaximumSize().height) {
        SwingGUI.this.setSize(SwingGUI.this.getSize().width,SwingGUI.this.getMaximumSize().height);
      }
      if (SwingGUI.this.getSize().width > SwingGUI.this.getMaximumSize().width) {
        SwingGUI.this.setSize(SwingGUI.this.getMaximumSize().width,SwingGUI.this.getSize().height);
      }
    }
  }
);
}
 

Example 45

From project Valkyrie-RCP, under directory /valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/.

Source file: SplitPaneExpansionToggleCommand.java

  19 
vote

public SplitPaneExpansionButtonModel(JSplitPane mySplitPane,boolean switchedAway){
  super();
  this.splitPane=mySplitPane;
  this.splitPane.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY,listener);
  this.splitPane.addComponentListener(new ComponentAdapter(){
    @Override public void componentResized(    ComponentEvent e){
      if (state == SWITCH_STATE.SWITCHED_AWAY || state == SWITCH_STATE.SWITCHED_AWAY_AND_MOVED)       hidePanel();
    }
  }
);
  if (switchedAway)   this.state=SWITCH_STATE.SWITCHED_AWAY;
}
 

Example 46

From project vnc, under directory /src/com/tigervnc/.

Source file: VncViewer.java

  19 
vote

public void componentResized(ComponentEvent e){
  if (e.getComponent() == vncFrame) {
    if (options.autoScale) {
      if (vncCanvas != null) {
        if (!vncCanvas.isFirstSizeAutoUpdate) {
          vncCanvas.updateFramebufferSize();
        }
      }
    }
  }
}
 

Example 47

From project Zypr-Reference-Client---Java, under directory /source/net/zypr/gui/panels/.

Source file: MapViewPanel.java

  19 
vote

private void this_componentResized(ComponentEvent componentEvent){
  _panelTop.setSize(getWidth(),_panelTop.getHeight());
  _panelBottom.setSize(getWidth(),_panelBottom.getHeight());
  _panelTop.setLocation(0,0);
  _panelBottom.setLocation(0,getHeight() - _panelBottom.getHeight());
  _mapCenterIcon.setLocation((getWidth() - _mapCenterIcon.getWidth()) / 2,(getHeight() - _mapCenterIcon.getHeight()) / 2);
  _buttonVoice.setLocation(20,_panelBottom.getY() - _buttonVoice.getHeight() * 2);
  _toggleButtonGPSLocation.setLocation(20,_buttonVoice.getY() - _toggleButtonGPSLocation.getHeight() * 2);
  _buttonZoomOut.setLocation(20,_buttonVoice.getY() - _buttonZoomOut.getHeight() * 2 - 20);
  _buttonZoomIn.setLocation(20,_buttonZoomOut.getY() - _buttonZoomIn.getHeight() * 2 + 20);
  _textFieldMapAttribution.setLocation(getWidth() - _textFieldMapAttribution.getWidth() - 10,getHeight() - _textFieldMapAttribution.getHeight() - 10);
}