private void setupUiListeners(){ myRootPanel.addAncestorListener(new AncestorAdapter(){ @Override public void ancestorAdded(AncestorEvent event) { reset(); } }); }
JPanel panel = new JPanel (); panel.addAncestorListener ( new AncestorListener () { public void ancestorAdded ( AncestorEvent event ) { // Component added somewhere } public void ancestorRemoved ( AncestorEvent event ) { // Component removed from container } public void ancestorMoved ( AncestorEvent event ) { // Component container moved } } );
private void initUI(StyledDocument document) { mainPanel = new JPanel(); textPane = new JTextPane(document); textPane.addMouseMotionListener(this); textPane.setFont(new Font("monospaced", Font.PLAIN, 13)); searcher = new Searcher(textPane); JScrollPane scrollPane = new JScrollPane(textPane); BoxLayout boxLayout = new BoxLayout(mainPanel, BoxLayout.Y_AXIS); mainPanel.setLayout(boxLayout); mainPanel.add(searcher.getSearchPanel()); mainPanel.add(scrollPane); searcher.getSearchPanel().setVisible(false); mainPanel.addAncestorListener(this); }
private void initUI() { panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); String pageLabelText = pageIndex < 0 ? "Page number not found" : "Page " + (pageIndex + 1); // append PDF page label, if available String lbl = PDFDebugger.getPageLabel(document, pageIndex); if (lbl != null) { pageLabelText += " - " + lbl; } JLabel pageLabel = new JLabel(pageLabelText); pageLabel.setAlignmentX(Component.CENTER_ALIGNMENT); pageLabel.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 20)); pageLabel.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0)); panel.add(pageLabel); label = new JLabel(); label.addMouseMotionListener(this); label.addMouseListener(this); label.setAlignmentX(Component.CENTER_ALIGNMENT); panel.add(label); panel.addAncestorListener(this); zoomMenu = ZoomMenu.getInstance(); zoomMenu.changeZoomSelection(zoomMenu.getPageZoomScale()); startRendering(); }
public static void keepComponentsWidthByVisibleArea(final JPanel panel, final SizeController sc) { panel.addAncestorListener(new AncestorListener() { @Override public void ancestorAdded(AncestorEvent event) {
/** Initialize the panel. */ public BreakpointConfigurationPanel(@NotNull CloudLineBreakpointType cloudLineBreakpointType) { this.cloudLineBreakpointType = cloudLineBreakpointType; // We conditionally show the "custom watches" panel only if we are shown in the dialog. watchPanel.addAncestorListener( new AncestorListener() { @Override public void ancestorAdded(AncestorEvent event) { JRootPane pane = watchPanel.getRootPane(); if (pane != null) { watchPanel.setVisible(UIUtil.isDialogRootPane(pane)); } } @Override public void ancestorMoved(AncestorEvent event) {} @Override public void ancestorRemoved(AncestorEvent event) {} }); }
private JPanel createBattlefieldSizePanel() { JPanel panel = new JPanel(); panel.addAncestorListener(eventHandler); Border border = BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Battlefield Size"), BorderFactory.createEmptyBorder(10, 10, 10, 10)); panel.setBorder(border); panel.setLayout(new BorderLayout()); JPanel sliderPanel = createBattlefieldSlidersPanel(); panel.add(sliderPanel, BorderLayout.CENTER); JPanel buttonsPanel = createPredefinedSizesPanel(); panel.add(buttonsPanel, BorderLayout.EAST); return panel; }
private JPanel createRulesPanel() { JPanel panel = new JPanel(); panel.addAncestorListener(new EventHandler()); panel.setBorder(BorderFactory.createEtchedBorder());
panel.add(mapPanel, BorderLayout.CENTER); panel.add(infoLabel, BorderLayout.SOUTH); panel.addAncestorListener(new AncestorListener() {
panel.add(mapPanel, BorderLayout.CENTER); panel.add(infoLabel, BorderLayout.SOUTH); panel.addAncestorListener(new AncestorListener() {
promptPane.addAncestorListener(new AncestorListener() {
public void setup(ISettingsManager settingsManager, BattleProperties battleProperties) { this.settingsManager = settingsManager; this.battleProperties = battleProperties; EventHandler eventHandler = new EventHandler(); battlefieldWidthSlider = createBattlefieldSizeSlider(); battlefieldWidthSlider.setOrientation(SwingConstants.HORIZONTAL); battlefieldHeightSlider = createBattlefieldSizeSlider(); battlefieldHeightSlider.setOrientation(SwingConstants.VERTICAL); battlefieldHeightSlider.setInverted(true); battlefieldSizeLabel = new BattlefieldSizeLabel(); battlefieldSizeLabel.setHorizontalAlignment(SwingConstants.CENTER); battlefieldSizeLabel.setMinimumSize(new Dimension(50, 50)); battlefieldSizeLabel.setMaximumSize(new Dimension(500, 500)); battlefieldWidthSlider.addChangeListener(eventHandler); battlefieldHeightSlider.addChangeListener(eventHandler); JPanel rulesPanel = createRulesPanel(); rulesPanel.addAncestorListener(eventHandler); restoreDefaultsButton.addActionListener(eventHandler); setLayout(new BorderLayout()); add(rulesPanel, BorderLayout.WEST); add(restoreDefaultsButton, BorderLayout.SOUTH); add(createBattlefieldSizePanel(), BorderLayout.CENTER); }
p.addAncestorListener(new AncestorAdapter() {
p.addAncestorListener( new AncestorAdapter() {