use of java.awt.event.ComponentEvent in project frostwire by frostwire.
the class LibraryLeftPanel method setupUI.
protected void setupUI() {
setLayout(new BorderLayout());
// Prepare a split pane with explorers
splitPane.setTopComponent(libraryExplorer);
splitPane.setBottomComponent(libraryPlaylists);
splitPane.setAutoscrolls(true);
add(splitPane, BorderLayout.CENTER);
Dimension minSize = new Dimension(MIN_WIDTH, MIN_WIDTH);
Dimension maxSize = new Dimension(MAX_WIDTH, MAX_WIDTH);
libraryCoverArtPanel.setPreferredSize(minSize);
libraryCoverArtPanel.setMinimumSize(minSize);
libraryCoverArtPanel.setMaximumSize(maxSize);
add(libraryCoverArtPanel, BorderLayout.PAGE_END);
addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e) {
layoutComponents();
}
});
DividerLocationSettingUpdater.install(splitPane, UISettings.UI_LIBRARY_EXPLORER_DIVIDER_POSITION);
}
use of java.awt.event.ComponentEvent in project jgnash by ccavanaugh.
the class DynamicJasperReportPanel method initializeUI.
private void initializeUI() {
GridBagConstraints gridBagConstraints;
JToolBar toolBar = new JToolBar();
firstButton = new JButton();
previousButton = new JButton();
nextButton = new JButton();
lastButton = new JButton();
actualSizeButton = new JToggleButton();
fitPageButton = new JToggleButton();
fitWidthButton = new JToggleButton();
zoomInButton = new JButton();
DefaultComboBoxModel<String> zoomModel = new DefaultComboBoxModel<>();
for (int z : ZOOM) {
zoomModel.addElement(z + "%");
}
zoomComboBox = new JComboBox<>(zoomModel);
DefaultComboBoxModel<Integer> fontModel = new DefaultComboBoxModel<>();
for (int i = 0; i <= 10; i++) {
fontModel.addElement(5 + i);
}
fontSizeComboBox = new JComboBox<>(fontModel);
fontSizeComboBox.setToolTipText(ResourceUtils.getString("ToolTip.FontSize"));
fontSizeComboBox.setSelectedItem(report.getBaseFontSize());
fontSizeComboBox.addActionListener(this);
zoomOutButton = new JButton();
mainPanel = new JPanel();
JScrollPane scrollPane = new JScrollPane();
scrollPanePanel = new JPanel();
pageGluePanel = new JPanel();
JPanel pagePanel = new JPanel();
JPanel shadowPanel1 = new JPanel();
JPanel shadowPanel2 = new JPanel();
JPanel shadowPanel3 = new JPanel();
JPanel shadowPanel4 = new JPanel();
JPanel shadowPanel5 = new JPanel();
setLayout(new BorderLayout());
toolBar.setFloatable(false);
toolBar.setRollover(true);
saveButton = new JButton(new ImageIcon(getClass().getResource("/jgnash/resource/document-save-as.png")));
saveButton.setToolTipText(resourceBundle.getString("save"));
saveButton.setFocusable(false);
saveButton.addActionListener(this);
toolBar.add(saveButton);
printButton = new JButton(new ImageIcon(getClass().getResource("/jgnash/resource/document-print.png")));
printButton.setToolTipText(resourceBundle.getString("print"));
printButton.setFocusable(false);
printButton.addActionListener(this);
toolBar.add(printButton);
toolBar.add(new JToolBar.Separator());
pageSetupButton = new JButton(new ImageIcon(getClass().getResource("/jgnash/resource/document-properties.png")));
pageSetupButton.setToolTipText(ResourceUtils.getString("ToolTip.PageSetup"));
pageSetupButton.setFocusable(false);
pageSetupButton.addActionListener(this);
toolBar.add(pageSetupButton);
fontSizeComboBox.setMaximumSize(new Dimension(50, pageSetupButton.getMinimumSize().height));
fontSizeComboBox.setMinimumSize(new Dimension(50, pageSetupButton.getMinimumSize().height));
fontSizeComboBox.setPreferredSize(new Dimension(50, pageSetupButton.getPreferredSize().height));
toolBar.add(fontSizeComboBox);
toolBar.add(new JToolBar.Separator());
firstButton.setIcon(new ImageIcon(getClass().getResource("/jgnash/resource/go-first.png")));
firstButton.setToolTipText(resourceBundle.getString("first.page"));
firstButton.setFocusable(false);
firstButton.setEnabled(false);
firstButton.addActionListener(this);
toolBar.add(firstButton);
previousButton.setIcon(new ImageIcon(getClass().getResource("/jgnash/resource/go-previous.png")));
previousButton.setToolTipText(resourceBundle.getString("previous.page"));
previousButton.setFocusable(false);
previousButton.setEnabled(false);
previousButton.addActionListener(this);
toolBar.add(previousButton);
nextButton.setIcon(new ImageIcon(getClass().getResource("/jgnash/resource/go-next.png")));
nextButton.setToolTipText(resourceBundle.getString("next.page"));
nextButton.setFocusable(false);
nextButton.setEnabled(false);
nextButton.addActionListener(this);
toolBar.add(nextButton);
lastButton.setIcon(new ImageIcon(getClass().getResource("/jgnash/resource/go-last.png")));
lastButton.setToolTipText(resourceBundle.getString("last.page"));
lastButton.setFocusable(false);
lastButton.setEnabled(false);
lastButton.addActionListener(this);
toolBar.add(lastButton);
toolBar.add(new JToolBar.Separator());
actualSizeButton.setIcon(new ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/actualsize.GIF")));
actualSizeButton.setToolTipText(resourceBundle.getString("actual.size"));
actualSizeButton.setFocusable(false);
actualSizeButton.addActionListener(this);
toolBar.add(actualSizeButton);
fitPageButton.setIcon(new ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/fitpage.GIF")));
fitPageButton.setToolTipText(resourceBundle.getString("fit.page"));
fitPageButton.setFocusable(false);
fitPageButton.addActionListener(this);
toolBar.add(fitPageButton);
fitWidthButton.setIcon(new ImageIcon(getClass().getResource("/net/sf/jasperreports/view/images/fitwidth.GIF")));
fitWidthButton.setToolTipText(resourceBundle.getString("fit.width"));
fitWidthButton.setFocusable(false);
fitWidthButton.addActionListener(this);
toolBar.add(fitWidthButton);
toolBar.add(new JToolBar.Separator());
zoomInButton.setIcon(new ImageIcon(getClass().getResource("/jgnash/resource/zoom-in.png")));
zoomInButton.setToolTipText(resourceBundle.getString("zoom.in"));
zoomInButton.setFocusable(false);
zoomInButton.addActionListener(this);
toolBar.add(zoomInButton);
zoomComboBox.setEditable(true);
zoomComboBox.setToolTipText(resourceBundle.getString("zoom.ratio"));
zoomComboBox.setMaximumSize(new Dimension(90, zoomInButton.getMinimumSize().height));
zoomComboBox.setMinimumSize(new Dimension(90, zoomInButton.getMinimumSize().height));
zoomComboBox.setPreferredSize(new Dimension(90, zoomInButton.getPreferredSize().height));
zoomComboBox.addItemListener(evt -> zoomStateChange());
zoomComboBox.addActionListener(this);
toolBar.add(zoomComboBox);
zoomOutButton.setIcon(new ImageIcon(getClass().getResource("/jgnash/resource/zoom-out.png")));
zoomOutButton.setToolTipText(resourceBundle.getString("zoom.out"));
zoomOutButton.setFocusable(false);
zoomOutButton.addActionListener(this);
toolBar.add(zoomOutButton);
JPanel reportController = report.getReportController();
if (reportController != null) {
JPanel panel = new JPanel(new BorderLayout());
panel.add(toolBar, BorderLayout.NORTH);
panel.add(reportController, BorderLayout.CENTER);
add(panel, BorderLayout.NORTH);
} else {
add(toolBar, BorderLayout.NORTH);
}
mainPanel.addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(final ComponentEvent evt) {
pnlMainComponentResized();
}
});
mainPanel.setLayout(new BorderLayout());
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
scrollPanePanel.setLayout(new GridBagLayout());
pageGluePanel.setLayout(new BorderLayout());
pagePanel.setLayout(new GridBagLayout());
spaceHoldPanel = new JPanel();
spaceHoldPanel.setMinimumSize(new Dimension(5, 5));
spaceHoldPanel.setOpaque(false);
spaceHoldPanel.setPreferredSize(new Dimension(5, 5));
spaceHoldPanel.setLayout(null);
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.gridheight = 2;
gridBagConstraints.fill = GridBagConstraints.BOTH;
pagePanel.add(spaceHoldPanel, gridBagConstraints);
shadowPanel1.setBackground(java.awt.Color.gray);
shadowPanel1.setMinimumSize(new Dimension(5, 5));
shadowPanel1.setPreferredSize(new Dimension(5, 5));
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = GridBagConstraints.VERTICAL;
pagePanel.add(shadowPanel1, gridBagConstraints);
shadowPanel2.setMinimumSize(new Dimension(5, 5));
shadowPanel2.setPreferredSize(new Dimension(5, 5));
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 2;
pagePanel.add(shadowPanel2, gridBagConstraints);
shadowPanel3.setBackground(Color.gray);
shadowPanel3.setMinimumSize(new Dimension(5, 5));
shadowPanel3.setPreferredSize(new Dimension(5, 5));
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 2;
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
pagePanel.add(shadowPanel3, gridBagConstraints);
shadowPanel4.setBackground(Color.gray);
shadowPanel4.setMinimumSize(new Dimension(5, 5));
shadowPanel4.setPreferredSize(new Dimension(5, 5));
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 2;
pagePanel.add(shadowPanel4, gridBagConstraints);
shadowPanel5.setMinimumSize(new Dimension(5, 5));
shadowPanel5.setPreferredSize(new Dimension(5, 5));
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 0;
pagePanel.add(shadowPanel5, gridBagConstraints);
pageRenderer = new PageRenderer(this);
pageRenderer.setBackground(Color.white);
pageRenderer.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0)));
pageRenderer.setOpaque(true);
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.gridheight = 2;
gridBagConstraints.fill = GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
pagePanel.add(pageRenderer, gridBagConstraints);
pageGluePanel.add(pagePanel, BorderLayout.CENTER);
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.insets = new Insets(5, 5, 5, 5);
scrollPanePanel.add(pageGluePanel, gridBagConstraints);
scrollPane.setViewportView(scrollPanePanel);
mainPanel.add(scrollPane, BorderLayout.CENTER);
add(mainPanel, BorderLayout.CENTER);
zoomComboBox.setSelectedIndex(DEFAULT_ZOOM_INDEX);
}
use of java.awt.event.ComponentEvent in project jgnash by ccavanaugh.
the class PartialSummary method initComponents.
private void initComponents() {
destLabel = new JLabel("Account");
transCount = new JLabel("0");
addComponentListener(new ComponentAdapter() {
@Override
public void componentShown(ComponentEvent evt) {
refreshInfo();
}
});
}
use of java.awt.event.ComponentEvent in project jgnash by ccavanaugh.
the class PartialTwo method initComponents.
private void initComponents() {
table = new PartialTable(qAcc);
deleteButton = new JButton(rb.getString("Button.Delete"));
helpPane = new JTextPane();
helpPane.setEditable(false);
helpPane.setEditorKit(new StyledEditorKit());
helpPane.setBackground(getBackground());
helpPane.setText(TextResource.getString("QifTwo.txt"));
addComponentListener(new ComponentAdapter() {
@Override
public void componentShown(ComponentEvent evt) {
refreshInfo();
}
});
deleteButton.addActionListener(this);
}
use of java.awt.event.ComponentEvent in project jdk8u_jdk by JetBrains.
the class XWindowPeer method setBounds.
//Fix for 6318144: PIT:Setting Min Size bigger than current size enlarges
//the window but fails to revalidate, Sol-CDE
//This bug is regression for
//5025858: Resizing a decorated frame triggers componentResized event twice.
//Since events are not posted from Component.setBounds we need to send them here.
//Note that this function is overriden in XDecoratedPeer so event
//posting is not changing for decorated peers
public void setBounds(int x, int y, int width, int height, int op) {
XToolkit.awtLock();
try {
Rectangle oldBounds = getBounds();
super.setBounds(x, y, width, height, op);
Rectangle bounds = getBounds();
XSizeHints hints = getHints();
setSizeHints(hints.get_flags() | XUtilConstants.PPosition | XUtilConstants.PSize, bounds.x, bounds.y, bounds.width, bounds.height);
XWM.setMotifDecor(this, false, 0, 0);
boolean isResized = !bounds.getSize().equals(oldBounds.getSize());
boolean isMoved = !bounds.getLocation().equals(oldBounds.getLocation());
if (isMoved || isResized) {
repositionSecurityWarning();
}
if (isResized) {
postEventToEventQueue(new ComponentEvent(getEventSource(), ComponentEvent.COMPONENT_RESIZED));
}
if (isMoved) {
postEventToEventQueue(new ComponentEvent(getEventSource(), ComponentEvent.COMPONENT_MOVED));
}
} finally {
XToolkit.awtUnlock();
}
}
Aggregations