javax.swing.JPanel.addAncestorListener()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(514)

本文整理了Java中javax.swing.JPanel.addAncestorListener()方法的一些代码示例,展示了JPanel.addAncestorListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JPanel.addAncestorListener()方法的具体详情如下:
包路径:javax.swing.JPanel
类名称:JPanel
方法名:addAncestorListener

JPanel.addAncestorListener介绍

暂无

代码示例

代码示例来源:origin: KronicDeth/intellij-elixir

private void setupUiListeners(){
 myRootPanel.addAncestorListener(new AncestorAdapter(){
  @Override
  public void ancestorAdded(AncestorEvent event) {
   reset();
  }
 });
}

代码示例来源:origin: stackoverflow.com

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
   }
 } );

代码示例来源:origin: apache/pdfbox

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);
}

代码示例来源:origin: apache/pdfbox

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();
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-team-commons

public static void keepComponentsWidthByVisibleArea(final JPanel panel, final SizeController sc) {
  panel.addAncestorListener(new AncestorListener() {
    @Override
    public void ancestorAdded(AncestorEvent event) {

代码示例来源:origin: GoogleCloudPlatform/google-cloud-intellij

/** 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) {}
   });
}

代码示例来源:origin: robo-code/robocode

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;
}

代码示例来源:origin: robo-code/robocode

private JPanel createRulesPanel() {
  JPanel panel = new JPanel();
  panel.addAncestorListener(new EventHandler());
  panel.setBorder(BorderFactory.createEtchedBorder());

代码示例来源:origin: senbox-org/snap-desktop

panel.add(mapPanel, BorderLayout.CENTER);
panel.add(infoLabel, BorderLayout.SOUTH);
panel.addAncestorListener(new AncestorListener() {

代码示例来源:origin: bcdev/beam

panel.add(mapPanel, BorderLayout.CENTER);
panel.add(infoLabel, BorderLayout.SOUTH);
panel.addAncestorListener(new AncestorListener() {

代码示例来源:origin: org.ihtsdo/wb-api

promptPane.addAncestorListener(new AncestorListener() {

代码示例来源:origin: robo-code/robocode

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);
}

代码示例来源:origin: org.bidib.org.oxbow/swingbits

p.addAncestorListener(new AncestorAdapter() {

代码示例来源:origin: eugener/oxbow

p.addAncestorListener( new AncestorAdapter() {

相关文章

JPanel类方法