|
|
|
@ -3,6 +3,7 @@ package com.fr.design.mainframe.toast;
|
|
|
|
|
import com.fr.concurrent.NamedThreadFactory; |
|
|
|
|
import com.fr.design.dialog.UIDialog; |
|
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
|
import com.fr.design.mainframe.DesignerFrame; |
|
|
|
|
import com.fr.module.ModuleContext; |
|
|
|
|
|
|
|
|
|
import javax.swing.JPanel; |
|
|
|
@ -51,12 +52,16 @@ public class ToastMsgDialog extends UIDialog {
|
|
|
|
|
hide_height = dimension.height; |
|
|
|
|
setSize(new Dimension(dimension.width, 0)); |
|
|
|
|
contentPane.setSize(dimension); |
|
|
|
|
setLocationRelativeTo(DesignerContext.getDesignerFrame().getContentFrame()); |
|
|
|
|
int positionY = DesignerContext.getDesignerFrame().getContentFrame().getLocationOnScreen().y + 10; |
|
|
|
|
setLocation((DesignerContext.getDesignerFrame().getWidth() - dimension.width) / 2, positionY); |
|
|
|
|
setRelativeLocation(dimension); |
|
|
|
|
addMouseEvent(contentPane); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void setRelativeLocation(Dimension dimension) { |
|
|
|
|
DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); |
|
|
|
|
int positionX = designerFrame.getLocationOnScreen().x + (designerFrame.getWidth() - dimension.width) / 2; |
|
|
|
|
int positionY = designerFrame.getContentFrame().getLocationOnScreen().y + 10; |
|
|
|
|
this.setLocation(positionX, positionY); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private Dimension calculatePreferSize() { |
|
|
|
|
Dimension contentDimension = contentPane.getPreferredSize(); |
|
|
|
@ -106,7 +111,7 @@ public class ToastMsgDialog extends UIDialog {
|
|
|
|
|
Dimension dimension = ToastMsgDialog.this.getSize(); |
|
|
|
|
ToastMsgDialog.this.setSize(new Dimension(dimension.width, dimension.height - 5)); |
|
|
|
|
} |
|
|
|
|
}, 0,50, TimeUnit.MILLISECONDS); |
|
|
|
|
}, 0, 50, TimeUnit.MILLISECONDS); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}, 5000, TimeUnit.MILLISECONDS); |
|
|
|
|