當前位置: 首頁>>代碼示例>>Java>>正文


Java ComponentAdapter類代碼示例

本文整理匯總了Java中java.awt.event.ComponentAdapter的典型用法代碼示例。如果您正苦於以下問題:Java ComponentAdapter類的具體用法?Java ComponentAdapter怎麽用?Java ComponentAdapter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ComponentAdapter類屬於java.awt.event包,在下文中一共展示了ComponentAdapter類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: AutoHideStatusText

import java.awt.event.ComponentAdapter; //導入依賴的package包/類
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();
        }
    });
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:AutoHideStatusText.java

示例2: ensureMinimumSize

import java.awt.event.ComponentAdapter; //導入依賴的package包/類
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));
                    }
                }
            });
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:UIUtils.java

示例3: FunctionDescriptionPanel

import java.awt.event.ComponentAdapter; //導入依賴的package包/類
/**
 * Creates a panel for the given {@link FunctionDescription}. When the panel is expanded, the
 * extra information is shown.
 *
 * @param functionEntry
 */
public FunctionDescriptionPanel(FunctionDescription functionEntry) {
	this.functionEntry = functionEntry;

	initGUI();
	if (functionEntry != null) {
		updateFunctionEntry(functionEntry);
		showMoreInformation(isExpanded);
	} else {
		showMoreInformation(false);
	}
	registerMouseListener();
	addComponentListener(new ComponentAdapter() {

		@Override
		public void componentResized(ComponentEvent arg0) {
			updateHeight();
		}
	});
	initialized = true;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:27,代碼來源:FunctionDescriptionPanel.java

示例4: JobProgressPanel

import java.awt.event.ComponentAdapter; //導入依賴的package包/類
/**
 * @param jobStatus
 *            - must never be null
 * @param jobType
 *            - type of job; copy, delete or set metadata
 */
public JobProgressPanel(JobStatus jobStatus, ManagedJob.Type jobType) {
    currentJobStatus = jobStatus;
    numberFormat = NumberFormat.getInstance();
    numberFormat.setGroupingUsed(true);
    this.jobType = jobType;
    processingModel = new ProcessingTableModel();
    completedModel = new CompletedTableModel();
    errorModel = new ErrorTableModel();
    initGuiComponents();

    addComponentListener(new ComponentAdapter() {
        public void componentResized(ComponentEvent evt) {
            resizeTables();
        }
    });
}
 
開發者ID:Hitachi-Data-Systems,項目名稱:Open-DM,代碼行數:23,代碼來源:JobProgressPanel.java

示例5: adicionarBotaoEditar

import java.awt.event.ComponentAdapter; //導入依賴的package包/類
private void adicionarBotaoEditar() {
    Tela t = this;
    btnEditar = new JButton("Editar");
    adicionarComponente(btnEditar, GridBagConstraints.EAST, 
                GridBagConstraints.NONE, 0, 0, 2, 1);
    btnEditar.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ae) {
            TelaEditarMusica tem = new TelaEditarMusica(musica.getNome(), musica, t);
            tem.setVisible(true);
            tem.addComponentListener(new ComponentAdapter() {
                @Override
                public void componentHidden(ComponentEvent e) {
                    musica = tem.getMusica();
                    editou = true;
                    adicionarValores();
                }
            });
        }
    });
}
 
開發者ID:k4t0mono,項目名稱:BachSys,代碼行數:22,代碼來源:TelaDadosMusica.java

示例6: FontPanel

import java.awt.event.ComponentAdapter; //導入依賴的package包/類
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();
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:27,代碼來源:FontPanel.java

示例7: SequenceDiagram

import java.awt.event.ComponentAdapter; //導入依賴的package包/類
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);
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:20,代碼來源:SequenceDiagram.java

示例8: QueryResultViewer

import java.awt.event.ComponentAdapter; //導入依賴的package包/類
public QueryResultViewer() {
	resultSet = null;
	tableModel = new DefaultTableModel();
	emptyResultLabel = new JLabel(EMPTY_RESULT_MSG);
	mainContainer = new JPanel();
	
	setLayout(new BorderLayout());
	tableSP = new JScrollPane(graphicTable,
			JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, 
			JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	tableSP.setBorder(BorderFactory.createEmptyBorder());
	
	graphicTable.setModel(tableModel);
	graphicTable.setFillsViewportHeight(true);
	graphicTable.setEnabled(false);
	
	addComponentListener(new ComponentAdapter() {
	    public void componentResized(ComponentEvent e) {
	        resizeColumnWidth(COL_MIN_WIDTH);          
	    }
	});
	
	mainContainer.add(tableSP);
	setLayout(new GridLayout(1,1));
	add(tableSP);
}
 
開發者ID:tteguayco,項目名稱:JITRAX,代碼行數:27,代碼來源:QueryResultViewer.java

示例9: insertPalette

import java.awt.event.ComponentAdapter; //導入依賴的package包/類
/**
 * 
 */
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);

  // Updates the widths of the palettes if the container size changes
  libraryPane.addComponentListener(new ComponentAdapter() {
    /**
     * 
     */
    public void componentResized(ComponentEvent e) {
      int w = scrollPane.getWidth() - scrollPane.getVerticalScrollBar().getWidth();
      palette.setPreferredWidth(w);
    }

  });

  return palette;
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:25,代碼來源:BasicGraphEditor.java

示例10: FontPanel

import java.awt.event.ComponentAdapter; //導入依賴的package包/類
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();
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:26,代碼來源:FontPanel.java

示例11: initGUI

import java.awt.event.ComponentAdapter; //導入依賴的package包/類
@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() + "...");
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:25,代碼來源:SetShape.java

示例12: setComponent

import java.awt.event.ComponentAdapter; //導入依賴的package包/類
/**
 * 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);
                }
            }
            
        });
    }
}
 
開發者ID:Esri,項目名稱:defense-solutions-proofs-of-concept,代碼行數:22,代碼來源:ComponentShowingButton.java

示例13: addRunConfiguration

import java.awt.event.ComponentAdapter; //導入依賴的package包/類
public void addRunConfiguration(@NotNull final ConfigurationFactory factory) {
  final RunConfigurable configurable = (RunConfigurable)getConfigurable();
  final SingleConfigurationConfigurable<RunConfiguration> configuration = configurable.createNewConfiguration(factory);

  if (!isVisible()) {
     getContentPanel().addComponentListener(new ComponentAdapter() {
       @Override
       public void componentShown(ComponentEvent e) {
         if (configuration != null) {
           configurable.updateRightPanel(configuration);
           getContentPanel().removeComponentListener(this);
         }
       }
     });
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:EditConfigurationsDialog.java

示例14: createGUI

import java.awt.event.ComponentAdapter; //導入依賴的package包/類
private void createGUI(){
    setLayout(new GridBagLayout());
    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);
    setSize(mText.length() * CHARACTER_LENGTH_MULTIPLIER, 25);
    getContentPane().setBackground(mBackgroundColor);
    
    JLabel label = new JLabel(mText);
    label.setForeground(mForegroundColor);
    add(label);
}
 
開發者ID:LouisJenkinsCS,項目名稱:Code-Glosser,代碼行數:21,代碼來源:Toast.java

示例15: ImageViewer

import java.awt.event.ComponentAdapter; //導入依賴的package包/類
public ImageViewer(String title, byte[] imageData) {
  

  imageIcon = new ImageIcon();
  imageLabel = new JLabel(imageIcon);

  this.setTitle(title);
  this.getContentPane().add(imageLabel);
  this.setSize(720, 400);
  this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  this.setVisible(true);

  setImageData(imageData);

  this.getRootPane().addComponentListener(new ComponentAdapter() {
    @Override
    public void componentResized(ComponentEvent e) {
      updateImage();
    }
  });

}
 
開發者ID:awslabs,項目名稱:ec2watch,代碼行數:23,代碼來源:ImageViewer.java


注:本文中的java.awt.event.ComponentAdapter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。