java.awt.event.ComponentAdapter Java Examples
The following examples show how to use
java.awt.event.ComponentAdapter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SingleSlider.java From 3Dscript with BSD 2-Clause "Simplified" License | 6 votes |
public SingleSliderCanvas(final int realMax, int setMax, Color color, SingleSlider slider) { this.color = color; this.slider = slider; this.setMax = setMax; this.realMax = realMax; this.diagram = new DiagramCanvas(); diagram.setMargins(2, 2, 2, 2); diagram.setBoundingBox(0, 0, realMax, 5); this.addMouseMotionListener(this); this.addMouseListener(this); this.setBackground(Color.WHITE); this.setFont(new Font("Helvetica", Font.PLAIN, 10)); this.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { diagram.setSizes(getWidth(), getHeight()); } }); }
Example #2
Source File: Toast.java From btdex with GNU General Public License v3.0 | 6 votes |
private void createGUI(){ addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { setShape(new RoundRectangle2D.Double(0, 0, getWidth(), getHeight(), WINDOW_RADIUS, WINDOW_RADIUS)); } }); setAlwaysOnTop(true); setUndecorated(true); setFocusableWindowState(false); setModalityType(ModalityType.MODELESS); getContentPane().setBackground(mBackgroundColor); JLabel label = new JLabel(mText); label.setFont(label.getFont().deriveFont(16.0f)); label.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); label.setForeground(mForegroundColor); add(label); pack(); }
Example #3
Source File: BehaviorSection.java From arcusplatform with Apache License 2.0 | 6 votes |
@Override protected Component createComponent() { JPanel content = new JPanel(new BorderLayout()); content.add(new JScrollPane(createBehaviorTable()), BorderLayout.CENTER); content.add(createToolbar(), BorderLayout.SOUTH); content.addComponentListener(new ComponentAdapter() { @Override public void componentShown(ComponentEvent e) { controller.refreshBehaviors(); } }); IrisClientFactory .getClient().addMessageListener(l -> { if (isBehavior().apply(l.getEvent())) { controller.refreshBehaviors(); } }); return content; }
Example #4
Source File: FontPanel.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public FontPanel( Font2DTest demo, JFrame f ) { f2dt = demo; parent = f; verticalBar = new JScrollBar ( JScrollBar.VERTICAL ); fc = new FontCanvas(); this.setLayout( new BorderLayout() ); this.add( "Center", fc ); this.add( "East", verticalBar ); verticalBar.addAdjustmentListener( this ); this.addComponentListener( new ComponentAdapter() { public void componentResized( ComponentEvent e ) { updateBackBuffer = true; updateFontMetrics = true; } }); /// Initialize font and its infos testFont = new Font(fontName, fontStyle, (int)fontSize); if ((float)((int)fontSize) != fontSize) { testFont = testFont.deriveFont(fontSize); } updateFontInfo(); }
Example #5
Source File: FontPanel.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public FontPanel( Font2DTest demo, JFrame f ) { f2dt = demo; parent = f; verticalBar = new JScrollBar ( JScrollBar.VERTICAL ); fc = new FontCanvas(); this.setLayout( new BorderLayout() ); this.add( "Center", fc ); this.add( "East", verticalBar ); verticalBar.addAdjustmentListener( this ); this.addComponentListener( new ComponentAdapter() { public void componentResized( ComponentEvent e ) { updateBackBuffer = true; updateFontMetrics = true; } }); /// Initialize font and its infos testFont = new Font(fontName, fontStyle, (int)fontSize); if ((float)((int)fontSize) != fontSize) { testFont = testFont.deriveFont(fontSize); } updateFontInfo(); }
Example #6
Source File: PagingFilterToolbar.java From arcusplatform with Apache License 2.0 | 6 votes |
private void init() { filterDescription = new JLabel("Filtering..."); setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); add(new JButton(filterAction)); add(filterDescription); add(Box.createHorizontalGlue()); add(new JButton(prevAction)); add(new JButton(nextAction)); addComponentListener(new ComponentAdapter() { @Override public void componentShown(ComponentEvent e) { reloadCurrentPage(); } }); }
Example #7
Source File: FlutterReduxGen.java From haystack with MIT License | 6 votes |
@Override public void onJsonParsed(PageModel pageModel) { if (pageModel.isUIOnly) { checkProjectStructure(pageModel); } else { ModelTableDialog tableDialog = new ModelTableDialog(pageModel, languageResolver, textResources, this); if (lastDialogLocation != null) { tableDialog.setLocation(lastDialogLocation); } tableDialog.addComponentListener(new ComponentAdapter() { public void componentMoved(ComponentEvent e) { lastDialogLocation = tableDialog.getLocation(); } }); tableDialog.pack(); tableDialog.setVisible(true); } }
Example #8
Source File: Popup401.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
private static void createAndShowGUI() { frame = new JFrame("HangPopupTest"); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.setSize(1000, 1000); test = new Popup401(); frame.add(test); frame.addComponentListener(new ComponentAdapter() { @Override public void componentShown(ComponentEvent e) { super.componentShown(e); test.run(); synchronized (testCompleted) { testCompleted.notifyAll(); } } }); frame.pack(); frame.setVisible(true); }
Example #9
Source File: VariableHeightPanel.java From ghidra with Apache License 2.0 | 6 votes |
/** * * Construct a new VariableHeigthPanel. * @param pack true means to fit as many components on a row, not worrying about lining up * columns; false means to fit as many components on a row, and line up the columns * as if in a grid * @param hgap horizontal gap between components * @param vgap vertical gap between components */ public VariableHeightPanel(final boolean pack, int hgap, int vgap) { this.pack = pack; this.hGap = hgap; this.vGap = vgap; setLayout(new VariableHeightLayoutManager(hGap, vGap, pack)); // this is needed to know when our the layout model changes this panel's height, which // requires that we notify our containing parent of the change so that it will re-layout // it's children to deal with our new space addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { invalidate(); getRootComponent(VariableHeightPanel.this).validate(); } }); }
Example #10
Source File: DashboardSection.java From arcusplatform with Apache License 2.0 | 6 votes |
@Override protected Component createComponent() { JPanel content = new JPanel(new BorderLayout()); content.add(new JScrollPane(createLogTable()), BorderLayout.CENTER); content.add(createToolbar(), BorderLayout.SOUTH); content.addComponentListener(new ComponentAdapter() { /* (non-Javadoc) * @see java.awt.event.ComponentAdapter#componentShown(java.awt.event.ComponentEvent) */ @Override public void componentShown(ComponentEvent e) { controller.refreshLogs(); } }); return content; }
Example #11
Source File: FontPanel.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public FontPanel( Font2DTest demo, JFrame f ) { f2dt = demo; parent = f; verticalBar = new JScrollBar ( JScrollBar.VERTICAL ); fc = new FontCanvas(); this.setLayout( new BorderLayout() ); this.add( "Center", fc ); this.add( "East", verticalBar ); verticalBar.addAdjustmentListener( this ); this.addComponentListener( new ComponentAdapter() { public void componentResized( ComponentEvent e ) { updateBackBuffer = true; updateFontMetrics = true; } }); /// Initialize font and its infos testFont = new Font(fontName, fontStyle, (int)fontSize); if ((float)((int)fontSize) != fontSize) { testFont = testFont.deriveFont(fontSize); } updateFontInfo(); }
Example #12
Source File: FontPanel.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public FontPanel( Font2DTest demo, JFrame f ) { f2dt = demo; parent = f; verticalBar = new JScrollBar ( JScrollBar.VERTICAL ); fc = new FontCanvas(); this.setLayout( new BorderLayout() ); this.add( "Center", fc ); this.add( "East", verticalBar ); verticalBar.addAdjustmentListener( this ); this.addComponentListener( new ComponentAdapter() { public void componentResized( ComponentEvent e ) { updateBackBuffer = true; updateFontMetrics = true; } }); /// Initialize font and its infos testFont = new Font(fontName, fontStyle, (int)fontSize); if ((float)((int)fontSize) != fontSize) { testFont = testFont.deriveFont(fontSize); } updateFontInfo(); }
Example #13
Source File: UIUtils.java From visualvm with GNU General Public License v2.0 | 6 votes |
public static void ensureMinimumSize(Component comp) { comp = getParentWindow(comp); if (comp != null) { final Component top = comp; top.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { Dimension d = top.getSize(); Dimension min = top.getMinimumSize(); if ((d.width < min.width) || (d.height < min.height)) { top.setSize(Math.max(d.width, min.width), Math.max(d.height, min.height)); } } }); } }
Example #14
Source File: AnalysisFrame.java From mylizzie with GNU General Public License v3.0 | 6 votes |
/** * Create the GUI and show it. For thread safety, this method should be * invoked from the event-dispatching thread. */ public static JDialog createAnalysisDialog(JFrame owner) { // Create and set up the window. JDialog dialog = new JDialog(owner, resourceBundle.getString("AnalysisFrame.title")); // Create and set up the content pane. final AnalysisFrame newContentPane = new AnalysisFrame(); newContentPane.setOpaque(true); // content panes must be opaque dialog.setContentPane(newContentPane); // Display the window. dialog.setSize(800, 600); // Handle close event dialog.addComponentListener(new ComponentAdapter() { @Override public void componentHidden(ComponentEvent e) { newContentPane.getAnalysisTableModel().setSelectedMove(null); Lizzie.optionSetting.setAnalysisWindowShow(false); } }); return dialog; }
Example #15
Source File: MatrixRain.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
public MatrixPanel() { try { InputStream is = MatrixRain.class.getClassLoader().getResourceAsStream( "fonts/katakana.ttf"); Font kf = Font.createFont(Font.TRUETYPE_FONT, is); int fontSize = 14; font = kf.deriveFont(Font.BOLD, fontSize); } catch (Exception exc) { exc.printStackTrace(); } SwingRepaintTimeline.repaintBuilder(this).playLoop(RepeatBehavior.LOOP); this.drops = new ArrayList<>(); this.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { while (drops.size() < 40) addDrop(); } }); }
Example #16
Source File: ClassViewer.java From java-disassembler with GNU General Public License v3.0 | 6 votes |
public ClassViewer(ViewerFile file) { super(file); updateName(); this.setLayout(new BorderLayout()); this.sp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panels.get(0), panels.get(1)); this.sp2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sp, panels.get(2)); this.add(sp2, BorderLayout.CENTER); refresh(null); this.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { resetDivider(); } }); }
Example #17
Source File: DoubleSlider.java From 3Dscript with BSD 2-Clause "Simplified" License | 6 votes |
public DoubleSliderCanvas(final int[] realMinMax, int[] setMinMax, Color color, DoubleSlider slider) { this.color = color; this.slider = slider; this.setMinMax = setMinMax; this.realMinMax = realMinMax; this.diagram = new DiagramCanvas(); diagram.setMargins(2, 2, 2, 2); diagram.setBoundingBox(realMinMax[0], 0, realMinMax[1], 5); this.addMouseMotionListener(this); this.addMouseListener(this); this.setBackground(Color.WHITE); this.setFont(new Font("Helvetica", Font.PLAIN, 10)); this.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { diagram.setSizes(getWidth(), getHeight()); repaint(); } }); }
Example #18
Source File: FontPanel.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public FontPanel( Font2DTest demo, JFrame f ) { f2dt = demo; parent = f; verticalBar = new JScrollBar ( JScrollBar.VERTICAL ); fc = new FontCanvas(); this.setLayout( new BorderLayout() ); this.add( "Center", fc ); this.add( "East", verticalBar ); verticalBar.addAdjustmentListener( this ); this.addComponentListener( new ComponentAdapter() { public void componentResized( ComponentEvent e ) { updateBackBuffer = true; updateFontMetrics = true; } }); /// Initialize font and its infos testFont = new Font(fontName, fontStyle, (int)fontSize); if ((float)((int)fontSize) != fontSize) { testFont = testFont.deriveFont(fontSize); } updateFontInfo(); }
Example #19
Source File: XTabbedPane.java From scelight with Apache License 2.0 | 6 votes |
@Override public void addTab( final String title, final IRIcon ricon, final Producer< JComponent > tabProducer, final boolean addTabMnemonic, final boolean closeable, final Runnable beforeCloseTask ) { // Wrapper component that listens to being shown first final BorderPanel p = new BorderPanel(); p.addComponentListener( new ComponentAdapter() { @Override public void componentShown( final ComponentEvent event ) { p.addCenter( tabProducer.produce() ); p.removeComponentListener( this ); p.validate(); } } ); addTab( title, ricon, p, addTabMnemonic, closeable, beforeCloseTask ); }
Example #20
Source File: AutoHideStatusText.java From netbeans with Apache License 2.0 | 6 votes |
private AutoHideStatusText( JFrame frame, JPanel statusContainer ) { this.statusContainer = statusContainer; Border outerBorder = UIManager.getBorder( "Nb.ScrollPane.border" ); //NOI18N if( null == outerBorder ) { outerBorder = BorderFactory.createEtchedBorder(); } panel.setBorder( BorderFactory.createCompoundBorder( outerBorder, BorderFactory.createEmptyBorder(3,3,3,3) ) ); lblStatus.setName("AutoHideStatusTextLabel"); //NOI18N panel.add( lblStatus, BorderLayout.CENTER ); frame.getLayeredPane().add( panel, Integer.valueOf( 101 ) ); StatusDisplayer.getDefault().addChangeListener( this ); frame.addComponentListener( new ComponentAdapter() { @Override public void componentResized( ComponentEvent e ) { run(); } }); }
Example #21
Source File: SequenceDiagram.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
public SequenceDiagram(long minTime, long maxTime, List<String> lineNames, LineMapper lineMapper) { this.lineNames = lineNames; this.shortLineNames = parseShortNames(lineNames, lineMapper); this.minTime = minTime; this.maxTime = maxTime; int width = getInitialWidth(); int height = 500; super.setPreferredSize(new Dimension(width, height)); resizeMe(width, height); addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { Component source = (Component) e.getSource(); resizeMe(source.getWidth(), source.getHeight()); } }); setBackground(Color.WHITE); }
Example #22
Source File: UIUtils.java From netbeans with Apache License 2.0 | 6 votes |
public static void ensureMinimumSize(Component comp) { comp = getParentWindow(comp); if (comp != null) { final Component top = comp; top.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { Dimension d = top.getSize(); Dimension min = top.getMinimumSize(); if ((d.width < min.width) || (d.height < min.height)) { top.setSize(Math.max(d.width, min.width), Math.max(d.height, min.height)); } } }); } }
Example #23
Source File: FontPanel.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public FontPanel( Font2DTest demo, JFrame f ) { f2dt = demo; parent = f; verticalBar = new JScrollBar ( JScrollBar.VERTICAL ); fc = new FontCanvas(); this.setLayout( new BorderLayout() ); this.add( "Center", fc ); this.add( "East", verticalBar ); verticalBar.addAdjustmentListener( this ); this.addComponentListener( new ComponentAdapter() { public void componentResized( ComponentEvent e ) { updateBackBuffer = true; updateFontMetrics = true; } }); /// Initialize font and its infos testFont = new Font(fontName, fontStyle, (int)fontSize); if ((float)((int)fontSize) != fontSize) { testFont = testFont.deriveFont(fontSize); } updateFontInfo(); }
Example #24
Source File: ProgressDialog.java From ApkToolPlus with Apache License 2.0 | 6 votes |
private void setupEventHandlers() { addComponentListener(new ComponentAdapter() { public void componentShown(ComponentEvent event) { final Thread task = new Thread(runnable); task.start(); new Thread() { public void run() { try { task.join(); } catch (InterruptedException e) { } SwingUtilities.invokeLater(new Runnable() { public void run() { setVisible(false); } }); } }.start(); } }); }
Example #25
Source File: FontPanel.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public FontPanel( Font2DTest demo, JFrame f ) { f2dt = demo; parent = f; verticalBar = new JScrollBar ( JScrollBar.VERTICAL ); fc = new FontCanvas(); this.setLayout( new BorderLayout() ); this.add( "Center", fc ); this.add( "East", verticalBar ); verticalBar.addAdjustmentListener( this ); this.addComponentListener( new ComponentAdapter() { public void componentResized( ComponentEvent e ) { updateBackBuffer = true; updateFontMetrics = true; } }); /// Initialize font and its infos testFont = new Font(fontName, fontStyle, (int)fontSize); if ((float)((int)fontSize) != fontSize) { testFont = testFont.deriveFont(fontSize); } updateFontInfo(); }
Example #26
Source File: FontPanel.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public FontPanel( Font2DTest demo, JFrame f ) { f2dt = demo; parent = f; verticalBar = new JScrollBar ( JScrollBar.VERTICAL ); fc = new FontCanvas(); this.setLayout( new BorderLayout() ); this.add( "Center", fc ); this.add( "East", verticalBar ); verticalBar.addAdjustmentListener( this ); this.addComponentListener( new ComponentAdapter() { public void componentResized( ComponentEvent e ) { updateFontMetrics = true; } }); /// Initialize font and its infos testFont = new Font(fontName, fontStyle, (int)fontSize); if ((float)((int)fontSize) != fontSize) { testFont = testFont.deriveFont(fontSize); } updateFontInfo(); }
Example #27
Source File: SetShape.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override public void initGUI() { if (windowClass.equals(Frame.class)) { window = new Frame(); ((Frame) window).setUndecorated(true); } else if (windowClass.equals(Dialog.class)) { window = new Dialog(background); ((Dialog) window).setUndecorated(true); } else { window = new Window(background); } window.setBackground(FG_COLOR); window.addComponentListener(new ComponentAdapter() { @Override public void componentResized(ComponentEvent e) { window.setShape(shape); } }); window.setSize(200, 200); window.setLocation(2*dl, 2*dl); window.setVisible(true); System.out.println("Checking " + window.getClass().getName() + "..."); }
Example #28
Source File: FontPanel.java From hottub with GNU General Public License v2.0 | 6 votes |
public FontPanel( Font2DTest demo, JFrame f ) { f2dt = demo; parent = f; verticalBar = new JScrollBar ( JScrollBar.VERTICAL ); fc = new FontCanvas(); this.setLayout( new BorderLayout() ); this.add( "Center", fc ); this.add( "East", verticalBar ); verticalBar.addAdjustmentListener( this ); this.addComponentListener( new ComponentAdapter() { public void componentResized( ComponentEvent e ) { updateBackBuffer = true; updateFontMetrics = true; } }); /// Initialize font and its infos testFont = new Font(fontName, fontStyle, (int)fontSize); if ((float)((int)fontSize) != fontSize) { testFont = testFont.deriveFont(fontSize); } updateFontInfo(); }
Example #29
Source File: FontPanel.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public FontPanel( Font2DTest demo, JFrame f ) { f2dt = demo; parent = f; verticalBar = new JScrollBar ( JScrollBar.VERTICAL ); fc = new FontCanvas(); this.setLayout( new BorderLayout() ); this.add( "Center", fc ); this.add( "East", verticalBar ); verticalBar.addAdjustmentListener( this ); this.addComponentListener( new ComponentAdapter() { public void componentResized( ComponentEvent e ) { updateBackBuffer = true; updateFontMetrics = true; } }); /// Initialize font and its infos testFont = new Font(fontName, fontStyle, (int)fontSize); if ((float)((int)fontSize) != fontSize) { testFont = testFont.deriveFont(fontSize); } updateFontInfo(); }
Example #30
Source File: ComponentShowingButton.java From defense-solutions-proofs-of-concept with Apache License 2.0 | 6 votes |
/** * Sets the component to be shown. * @param component the component to be shown. * @param parent the container to which the shown component should be added. * This parameter can be null if you add the component yourself. */ public void setComponent(Component component) { this.component = component; if (null != component) { component.addComponentListener(new ComponentAdapter() { @Override public void componentHidden(ComponentEvent e) { if (null != unselectButton && isSelected()) { unselectButton.setSelected(true); } } }); } }