mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-06 11:05:18 +00:00
copyright year updated
This commit is contained in:
@@ -1,88 +1,88 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2014 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.ComponentListener;
|
||||
import java.awt.event.ContainerEvent;
|
||||
import java.awt.event.ContainerListener;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class ButtonsPanel extends JPanel {
|
||||
|
||||
private ComponentListener listener;
|
||||
|
||||
public ButtonsPanel() {
|
||||
super(new FlowLayout());
|
||||
|
||||
listener = new ComponentListener() {
|
||||
|
||||
@Override
|
||||
public void componentResized(ComponentEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentMoved(ComponentEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentShown(ComponentEvent e) {
|
||||
updateVisibility();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentHidden(ComponentEvent e) {
|
||||
updateVisibility();
|
||||
}
|
||||
};
|
||||
|
||||
this.addContainerListener(new ContainerListener() {
|
||||
|
||||
@Override
|
||||
public void componentAdded(ContainerEvent e) {
|
||||
e.getComponent().addComponentListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentRemoved(ContainerEvent e) {
|
||||
e.getComponent().removeComponentListener(listener);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateVisibility() {
|
||||
|
||||
// hide button panel when no button is visible
|
||||
boolean visible = false;
|
||||
for (Component component : getComponents()) {
|
||||
if (component instanceof JButton) {
|
||||
JButton button = (JButton) component;
|
||||
if (button.isVisible()) {
|
||||
visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
setVisible(visible);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.gui;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.ComponentListener;
|
||||
import java.awt.event.ContainerEvent;
|
||||
import java.awt.event.ContainerListener;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class ButtonsPanel extends JPanel {
|
||||
|
||||
private ComponentListener listener;
|
||||
|
||||
public ButtonsPanel() {
|
||||
super(new FlowLayout());
|
||||
|
||||
listener = new ComponentListener() {
|
||||
|
||||
@Override
|
||||
public void componentResized(ComponentEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentMoved(ComponentEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentShown(ComponentEvent e) {
|
||||
updateVisibility();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentHidden(ComponentEvent e) {
|
||||
updateVisibility();
|
||||
}
|
||||
};
|
||||
|
||||
this.addContainerListener(new ContainerListener() {
|
||||
|
||||
@Override
|
||||
public void componentAdded(ContainerEvent e) {
|
||||
e.getComponent().addComponentListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentRemoved(ContainerEvent e) {
|
||||
e.getComponent().removeComponentListener(listener);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateVisibility() {
|
||||
|
||||
// hide button panel when no button is visible
|
||||
boolean visible = false;
|
||||
for (Component component : getComponents()) {
|
||||
if (component instanceof JButton) {
|
||||
JButton button = (JButton) component;
|
||||
if (button.isVisible()) {
|
||||
visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
setVisible(visible);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user