本文整理汇总了Java中javax.swing.event.InternalFrameListener类的典型用法代码示例。如果您正苦于以下问题:Java InternalFrameListener类的具体用法?Java InternalFrameListener怎么用?Java InternalFrameListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InternalFrameListener类属于javax.swing.event包,在下文中一共展示了InternalFrameListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addInternalFrameListener
import javax.swing.event.InternalFrameListener; //导入依赖的package包/类
/**
* Maps
* {@code JInternalFrame.addInternalFrameListener(InternalFrameListener)}
* through queue
*/
public void addInternalFrameListener(final InternalFrameListener internalFrameListener) {
runMapping(new MapVoidAction("addInternalFrameListener") {
@Override
public void map() {
((JInternalFrame) getSource()).addInternalFrameListener(internalFrameListener);
}
});
}
示例2: removeInternalFrameListener
import javax.swing.event.InternalFrameListener; //导入依赖的package包/类
/**
* Maps
* {@code JInternalFrame.removeInternalFrameListener(InternalFrameListener)}
* through queue
*/
public void removeInternalFrameListener(final InternalFrameListener internalFrameListener) {
runMapping(new MapVoidAction("removeInternalFrameListener") {
@Override
public void map() {
((JInternalFrame) getSource()).removeInternalFrameListener(internalFrameListener);
}
});
}
示例3: add
import javax.swing.event.InternalFrameListener; //导入依赖的package包/类
@Override
public Component add( Component toadd ) {
Component frames[] = getAllFrames();
// we want to stagger the top left corner of the window
int topleft = CASCADE_STEPSIZE * ( null == frames ? 0 : frames.length );
Component cmp = super.add( toadd );
if ( toadd instanceof JInternalFrame ) {
JInternalFrame jif = JInternalFrame.class.cast( toadd );
for ( InternalFrameListener ifl : framelisteners ) {
jif.addInternalFrameListener( ifl );
}
if ( null != tblistener ) {
jif.addInternalFrameListener( tblistener );
jif.pack();
Dimension paneSize = getSize();
toadd.setSize( paneSize.width - topleft, paneSize.height - topleft );
toadd.setLocation( topleft, topleft );
if ( jif instanceof PlaySheetFrame ) {
PlaySheetFrame psf = PlaySheetFrame.class.cast( jif );
psf.addChangeListener( tblistener );
psf.addedToDesktop( this );
}
toadd.setVisible( true );
}
}
return cmp;
}
示例4: backupProperties
import javax.swing.event.InternalFrameListener; //导入依赖的package包/类
private void backupProperties(JInternalFrame frame) {
oldDefaultCloseOperation = frame.getDefaultCloseOperation();
frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
oldInternalFrameListeners = frame.getInternalFrameListeners();
for (InternalFrameListener listener : oldInternalFrameListeners) {
frame.removeInternalFrameListener(listener);
}
}
示例5: getPaletteInternalWindow
import javax.swing.event.InternalFrameListener; //导入依赖的package包/类
/**
* Get a layer's associated palette as an internal window
*
* @param gui the Component to place in the window
* @param ifl the listener to associate with the palette
* @return the frame that the palette is in
*/
public static JInternalFrame getPaletteInternalWindow(
Component gui,
String windowName,
InternalFrameListener ifl) {
JInternalFrame paletteWindow;
// create the palette's scroll pane
JScrollPane scrollPane = new JScrollPane(gui, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPane.setAlignmentX(Component.LEFT_ALIGNMENT);
scrollPane.setAlignmentY(Component.TOP_ALIGNMENT);
// create the palette internal window
paletteWindow = new JInternalFrame(windowName, true, //resizable
true, //closable
false, //maximizable
true //iconifiable
);
// add a window listener that destroys the palette when
// the window is closed
paletteWindow.addInternalFrameListener(ifl);
paletteWindow.getContentPane().add(scrollPane);
paletteWindow.setOpaque(true);
//layout all the components
paletteWindow.pack();
return paletteWindow;
}
示例6: fireInternalFrameEvent
import javax.swing.event.InternalFrameListener; //导入依赖的package包/类
/**
* Fires the internal frame event.
*
* @param id identifier of the event to fire
*/
protected void fireInternalFrameEvent(final int id) {
Object[] listeners = listenerList.getListenerList();
InternalFrameEvent e = null;
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == InternalFrameListener.class) {
if (e == null) {
e = new InternalFrameEvent(this, id);
}
InternalFrameListener l = (InternalFrameListener) listeners[i + 1];
switch (id) {
case InternalFrameEvent.INTERNAL_FRAME_ACTIVATED:
l.internalFrameActivated(e);
break;
case InternalFrameEvent.INTERNAL_FRAME_DEACTIVATED:
l.internalFrameDeactivated(e);
break;
case InternalFrameEvent.INTERNAL_FRAME_ICONIFIED:
l.internalFrameIconified(e);
break;
case InternalFrameEvent.INTERNAL_FRAME_DEICONIFIED:
l.internalFrameDeiconified(e);
break;
case InternalFrameEvent.INTERNAL_FRAME_CLOSING:
l.internalFrameClosing(e);
break;
case InternalFrameEvent.INTERNAL_FRAME_OPENED:
l.internalFrameOpened(e);
break;
case InternalFrameEvent.INTERNAL_FRAME_CLOSED:
l.internalFrameClosed(e);
break;
}
}
}
}
示例7: postClosingEvent
import javax.swing.event.InternalFrameListener; //导入依赖的package包/类
protected void postClosingEvent(final JInternalFrame frame) {
// this method seems to be unused
Object[] listeners = frame.getListeners(InternalFrameListener.class);
InternalFrameEvent e = null;
for (int i = 0; i < listeners.length; i++) {
if (e == null) {
e = new InternalFrameEvent(
frame, InternalFrameEvent.INTERNAL_FRAME_CLOSING);
}
((InternalFrameListener)listeners[i]).internalFrameClosing(e);
}
}
示例8: testAddRemoveGetInternalFrameListener
import javax.swing.event.InternalFrameListener; //导入依赖的package包/类
public void testAddRemoveGetInternalFrameListener() {
InternalFrameListener l = new MyInternalFrameListener();
frame.addInternalFrameListener(l);
InternalFrameListener[] listeners = frame.getInternalFrameListeners();
assertTrue("listener was added", contains(listeners, l));
frame.removeInternalFrameListener(l);
listeners = frame.getInternalFrameListeners();
assertFalse("listener was removed", contains(listeners, l));
}
示例9: addInternalFrameListener
import javax.swing.event.InternalFrameListener; //导入依赖的package包/类
@Override
public void addInternalFrameListener(InternalFrameListener l) {
super.addInternalFrameListener(l);
}
示例10: addInternalFrameListener
import javax.swing.event.InternalFrameListener; //导入依赖的package包/类
public void addInternalFrameListener(InternalFrameListener l) {
list.add(InternalFrameListener.class, l);
}
示例11: removeInternalFrameListener
import javax.swing.event.InternalFrameListener; //导入依赖的package包/类
public void removeInternalFrameListener(InternalFrameListener l) {
list.remove(InternalFrameListener.class, l);
}
示例12: getInternalFrameListeners
import javax.swing.event.InternalFrameListener; //导入依赖的package包/类
public InternalFrameListener[] getInternalFrameListeners() {
return list.getListeners(InternalFrameListener.class);
}
示例13: fireInternalFrameEvent
import javax.swing.event.InternalFrameListener; //导入依赖的package包/类
/**
* This method fires an InternalFrameEvent to the listeners.
*
* @param id The type of event being fired. See InternalFrameEvent.
*/
protected void fireInternalFrameEvent(int id)
{
Object[] ifListeners = listenerList.getListenerList();
InternalFrameEvent evt = new InternalFrameEvent(this, id);
switch (id)
{
case InternalFrameEvent.INTERNAL_FRAME_CLOSING:
for (int i = ifListeners.length - 2; i >= 0; i -= 2)
{
if (ifListeners[i] == InternalFrameListener.class)
((InternalFrameListener) ifListeners[i + 1])
.internalFrameClosing(evt);
}
break;
case InternalFrameEvent.INTERNAL_FRAME_ACTIVATED:
for (int i = ifListeners.length - 2; i >= 0; i -= 2)
{
if (ifListeners[i] == InternalFrameListener.class)
((InternalFrameListener) ifListeners[i + 1])
.internalFrameActivated(evt);
}
break;
case InternalFrameEvent.INTERNAL_FRAME_CLOSED:
for (int i = ifListeners.length - 2; i >= 0; i -= 2)
{
if (ifListeners[i] == InternalFrameListener.class)
((InternalFrameListener) ifListeners[i + 1]).internalFrameClosed(evt);
}
break;
case InternalFrameEvent.INTERNAL_FRAME_DEACTIVATED:
for (int i = ifListeners.length - 2; i >= 0; i -= 2)
{
if (ifListeners[i] == InternalFrameListener.class)
((InternalFrameListener) ifListeners[i + 1])
.internalFrameDeactivated(evt);
}
break;
case InternalFrameEvent.INTERNAL_FRAME_DEICONIFIED:
for (int i = ifListeners.length - 2; i >= 0; i -= 2)
{
if (ifListeners[i] == InternalFrameListener.class)
((InternalFrameListener) ifListeners[i + 1])
.internalFrameDeiconified(evt);
}
break;
case InternalFrameEvent.INTERNAL_FRAME_ICONIFIED:
for (int i = ifListeners.length - 2; i >= 0; i -= 2)
{
if (ifListeners[i] == InternalFrameListener.class)
((InternalFrameListener) ifListeners[i + 1])
.internalFrameIconified(evt);
}
break;
case InternalFrameEvent.INTERNAL_FRAME_OPENED:
for (int i = ifListeners.length - 2; i >= 0; i -= 2)
{
if (ifListeners[i] == InternalFrameListener.class)
((InternalFrameListener) ifListeners[i + 1]).internalFrameOpened(evt);
}
break;
}
}
示例14: fireInternalFrameEvent
import javax.swing.event.InternalFrameListener; //导入依赖的package包/类
/**
* This method fires an InternalFrameEvent to the listeners.
*
* @param id The type of event being fired. See InternalFrameEvent.
*/
protected void fireInternalFrameEvent(int id)
{
Object[] ifListeners = listenerList.getListenerList();
InternalFrameEvent evt = new InternalFrameEvent(this, id);
switch (id)
{
case InternalFrameEvent.INTERNAL_FRAME_CLOSING:
for (int i = ifListeners.length - 2; i >= 0; i -= 2)
{
if (ifListeners[i] == InternalFrameListener.class)
((InternalFrameListener) ifListeners[i + 1])
.internalFrameClosing(evt);
}
break;
case InternalFrameEvent.INTERNAL_FRAME_ACTIVATED:
for (int i = ifListeners.length - 2; i >= 0; i -= 2)
{
if (ifListeners[i] == InternalFrameListener.class)
((InternalFrameListener) ifListeners[i + 1])
.internalFrameActivated(evt);
}
break;
case InternalFrameEvent.INTERNAL_FRAME_CLOSED:
for (int i = ifListeners.length - 2; i >= 0; i -= 2)
{
if (ifListeners[i] == InternalFrameListener.class)
((InternalFrameListener) ifListeners[i + 1]).internalFrameClosed(evt);
}
break;
case InternalFrameEvent.INTERNAL_FRAME_DEACTIVATED:
for (int i = ifListeners.length - 2; i >= 0; i -= 2)
{
if (ifListeners[i] == InternalFrameListener.class)
((InternalFrameListener) ifListeners[i + 1])
.internalFrameDeactivated(evt);
}
break;
case InternalFrameEvent.INTERNAL_FRAME_DEICONIFIED:
for (int i = ifListeners.length - 2; i >= 0; i -= 2)
{
if (ifListeners[i] == InternalFrameListener.class)
((InternalFrameListener) ifListeners[i + 1])
.internalFrameDeiconified(evt);
}
break;
case InternalFrameEvent.INTERNAL_FRAME_ICONIFIED:
for (int i = ifListeners.length - 2; i >= 0; i -= 2)
{
if (ifListeners[i] == InternalFrameListener.class)
((InternalFrameListener) ifListeners[i + 1])
.internalFrameIconified(evt);
}
break;
case InternalFrameEvent.INTERNAL_FRAME_OPENED:
for (int i = ifListeners.length - 2; i >= 0; i -= 2)
{
if (ifListeners[i] == InternalFrameListener.class)
((InternalFrameListener) ifListeners[i + 1]).internalFrameOpened(evt);
}
break;
}
}
示例15: fireInternalFrameEvent
import javax.swing.event.InternalFrameListener; //导入依赖的package包/类
/**
* Fires an internal frame event.
*
* @param id the type of the event being fired; one of the following:
* <ul>
* <li><code>InternalFrameEvent.INTERNAL_FRAME_OPENED</code>
* <li><code>InternalFrameEvent.INTERNAL_FRAME_CLOSING</code>
* <li><code>InternalFrameEvent.INTERNAL_FRAME_CLOSED</code>
* <li><code>InternalFrameEvent.INTERNAL_FRAME_ICONIFIED</code>
* <li><code>InternalFrameEvent.INTERNAL_FRAME_DEICONIFIED</code>
* <li><code>InternalFrameEvent.INTERNAL_FRAME_ACTIVATED</code>
* <li><code>InternalFrameEvent.INTERNAL_FRAME_DEACTIVATED</code>
* </ul>
* If the event type is not one of the above, nothing happens.
*/
protected void fireInternalFrameEvent(int id){
Object[] listeners = listenerList.getListenerList();
InternalFrameEvent e = null;
for (int i = listeners.length -2; i >=0; i -= 2){
if (listeners[i] == InternalFrameListener.class){
if (e == null){
e = new InternalFrameEvent(this, id);
// System.out.println("InternalFrameEvent: " + e.paramString());
}
switch(e.getID()) {
case InternalFrameEvent.INTERNAL_FRAME_OPENED:
((InternalFrameListener)listeners[i+1]).internalFrameOpened(e);
break;
case InternalFrameEvent.INTERNAL_FRAME_CLOSING:
((InternalFrameListener)listeners[i+1]).internalFrameClosing(e);
break;
case InternalFrameEvent.INTERNAL_FRAME_CLOSED:
((InternalFrameListener)listeners[i+1]).internalFrameClosed(e);
break;
case InternalFrameEvent.INTERNAL_FRAME_ICONIFIED:
((InternalFrameListener)listeners[i+1]).internalFrameIconified(e);
break;
case InternalFrameEvent.INTERNAL_FRAME_DEICONIFIED:
((InternalFrameListener)listeners[i+1]).internalFrameDeiconified(e);
break;
case InternalFrameEvent.INTERNAL_FRAME_ACTIVATED:
((InternalFrameListener)listeners[i+1]).internalFrameActivated(e);
break;
case InternalFrameEvent.INTERNAL_FRAME_DEACTIVATED:
((InternalFrameListener)listeners[i+1]).internalFrameDeactivated(e);
break;
default:
break;
}
}
}
/* we could do it off the event, but at the moment, that's not how
I'm implementing it */
// if (id == InternalFrameEvent.INTERNAL_FRAME_CLOSING) {
// doDefaultCloseAction();
// }
}