|
|
@ -9,14 +9,17 @@ import com.fr.stable.Constants; |
|
|
|
import javax.swing.JComponent; |
|
|
|
import javax.swing.JComponent; |
|
|
|
import javax.swing.JPanel; |
|
|
|
import javax.swing.JPanel; |
|
|
|
import javax.swing.SwingUtilities; |
|
|
|
import javax.swing.SwingUtilities; |
|
|
|
|
|
|
|
import javax.swing.border.Border; |
|
|
|
import java.awt.AWTEvent; |
|
|
|
import java.awt.AWTEvent; |
|
|
|
import java.awt.BasicStroke; |
|
|
|
import java.awt.BasicStroke; |
|
|
|
import java.awt.BorderLayout; |
|
|
|
import java.awt.BorderLayout; |
|
|
|
import java.awt.Color; |
|
|
|
import java.awt.Color; |
|
|
|
|
|
|
|
import java.awt.Component; |
|
|
|
import java.awt.Dialog; |
|
|
|
import java.awt.Dialog; |
|
|
|
import java.awt.Frame; |
|
|
|
import java.awt.Frame; |
|
|
|
import java.awt.Graphics; |
|
|
|
import java.awt.Graphics; |
|
|
|
import java.awt.Graphics2D; |
|
|
|
import java.awt.Graphics2D; |
|
|
|
|
|
|
|
import java.awt.Insets; |
|
|
|
import java.awt.Point; |
|
|
|
import java.awt.Point; |
|
|
|
import java.awt.Polygon; |
|
|
|
import java.awt.Polygon; |
|
|
|
import java.awt.Rectangle; |
|
|
|
import java.awt.Rectangle; |
|
|
@ -82,15 +85,17 @@ public abstract class UIBubbleFloatPane<T> extends BasicBeanPane<T> { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* show对话框 |
|
|
|
* show对话框 |
|
|
|
|
|
|
|
* |
|
|
|
* @param fatherPane 上一层界面 parentPane |
|
|
|
* @param fatherPane 上一层界面 parentPane |
|
|
|
* @param ob 传入的内容,在show之前populate |
|
|
|
* @param ob 传入的内容,在show之前populate |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void show(JComponent fatherPane, T ob) { |
|
|
|
public void show(JComponent fatherPane, T ob) { |
|
|
|
populateBean(ob); |
|
|
|
populateBean(ob); |
|
|
|
UIDialog dialog = showUnsizedWindow(SwingUtilities.getWindowAncestor(fatherPane)); |
|
|
|
if (showDialog == null) { |
|
|
|
showDialog = dialog; |
|
|
|
showDialog = showUnsizedWindow(SwingUtilities.getWindowAncestor(fatherPane)); |
|
|
|
|
|
|
|
} |
|
|
|
Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); |
|
|
|
Toolkit.getDefaultToolkit().addAWTEventListener(awt, AWTEvent.MOUSE_EVENT_MASK); |
|
|
|
dialog.setVisible(true); |
|
|
|
showDialog.setVisible(true); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -240,14 +245,14 @@ public abstract class UIBubbleFloatPane<T> extends BasicBeanPane<T> { |
|
|
|
polygon.addPoint(GAP_SMALL, (int) ((bounds.height + GAP) * time - GAP_BIG)); |
|
|
|
polygon.addPoint(GAP_SMALL, (int) ((bounds.height + GAP) * time - GAP_BIG)); |
|
|
|
polygon.addPoint(GAP_SMALL, 0); |
|
|
|
polygon.addPoint(GAP_SMALL, 0); |
|
|
|
} else if (arrowPosition == Constants.TOP) { |
|
|
|
} else if (arrowPosition == Constants.TOP) { |
|
|
|
polygon.addPoint(0, GAP_SMALL); |
|
|
|
polygon.addPoint(0, GAP_SMALL - 2); |
|
|
|
polygon.addPoint((int) (bounds.width * time + GAP_SMALL), GAP_SMALL); |
|
|
|
polygon.addPoint((int) (bounds.width * time + GAP_SMALL), GAP_SMALL - 2); |
|
|
|
polygon.addPoint((int) (bounds.width * time + GAP), 0); |
|
|
|
polygon.addPoint((int) (bounds.width * time + GAP), 0); |
|
|
|
polygon.addPoint((int) (bounds.getWidth() * time + GAP_BIG), GAP_SMALL); |
|
|
|
polygon.addPoint((int) (bounds.getWidth() * time + GAP_BIG), GAP_SMALL - 2); |
|
|
|
polygon.addPoint(bounds.width + GAP, GAP_SMALL); |
|
|
|
polygon.addPoint(bounds.width + GAP, GAP_SMALL - 2); |
|
|
|
polygon.addPoint(bounds.width + GAP, bounds.height + GAP_BIG); |
|
|
|
polygon.addPoint(bounds.width + GAP, bounds.height + GAP_BIG); |
|
|
|
polygon.addPoint(0, bounds.height + GAP_BIG); |
|
|
|
polygon.addPoint(0, bounds.height + GAP_BIG); |
|
|
|
polygon.addPoint(0, GAP_SMALL); |
|
|
|
polygon.addPoint(0, GAP_SMALL - 2); |
|
|
|
} else if (arrowPosition == Constants.RIGHT) { |
|
|
|
} else if (arrowPosition == Constants.RIGHT) { |
|
|
|
polygon.addPoint(0, 0); |
|
|
|
polygon.addPoint(0, 0); |
|
|
|
polygon.addPoint(bounds.width + GAP, 0); |
|
|
|
polygon.addPoint(bounds.width + GAP, 0); |
|
|
@ -274,14 +279,14 @@ public abstract class UIBubbleFloatPane<T> extends BasicBeanPane<T> { |
|
|
|
polygon.addPoint(GAP_SMALL + 1, (int) ((bounds.height + GAP) * time - GAP_BIG)); |
|
|
|
polygon.addPoint(GAP_SMALL + 1, (int) ((bounds.height + GAP) * time - GAP_BIG)); |
|
|
|
polygon.addPoint(GAP_SMALL + 1, 1); |
|
|
|
polygon.addPoint(GAP_SMALL + 1, 1); |
|
|
|
} else if (arrowPosition == Constants.TOP) { |
|
|
|
} else if (arrowPosition == Constants.TOP) { |
|
|
|
polygon.addPoint(1, GAP_SMALL + 1); |
|
|
|
polygon.addPoint(1, GAP_SMALL - 1); |
|
|
|
polygon.addPoint((int) (bounds.width * time + GAP_SMALL), GAP_SMALL + 1); |
|
|
|
polygon.addPoint((int) (bounds.width * time + GAP_SMALL), GAP_SMALL - 1); |
|
|
|
polygon.addPoint((int) (bounds.width * time + GAP), 1); |
|
|
|
polygon.addPoint((int) (bounds.width * time + GAP), 1); |
|
|
|
polygon.addPoint((int) (bounds.getWidth() * time + GAP_BIG), GAP_SMALL + 1); |
|
|
|
polygon.addPoint((int) (bounds.getWidth() * time + GAP_BIG), GAP_SMALL - 1); |
|
|
|
polygon.addPoint(bounds.width + GAP - 1, GAP_SMALL + 1); |
|
|
|
polygon.addPoint(bounds.width + GAP - 1, GAP_SMALL - 1); |
|
|
|
polygon.addPoint(bounds.width + GAP - 1, bounds.height + GAP_BIG - 1); |
|
|
|
polygon.addPoint(bounds.width + GAP - 1, bounds.height + GAP_BIG - 1); |
|
|
|
polygon.addPoint(1, bounds.height + GAP_BIG - 1); |
|
|
|
polygon.addPoint(1, bounds.height + GAP_BIG - 1); |
|
|
|
polygon.addPoint(1, GAP_SMALL + 1); |
|
|
|
polygon.addPoint(1, GAP_SMALL - 1); |
|
|
|
} else if (arrowPosition == Constants.RIGHT) { |
|
|
|
} else if (arrowPosition == Constants.RIGHT) { |
|
|
|
polygon.addPoint(1, 1); |
|
|
|
polygon.addPoint(1, 1); |
|
|
|
polygon.addPoint(bounds.width + GAP - 1, 1); |
|
|
|
polygon.addPoint(bounds.width + GAP - 1, 1); |
|
|
@ -295,19 +300,6 @@ public abstract class UIBubbleFloatPane<T> extends BasicBeanPane<T> { |
|
|
|
return polygon; |
|
|
|
return polygon; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 画出界面的样式, 边框等. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void paint(Graphics g) { |
|
|
|
|
|
|
|
super.paint(g); |
|
|
|
|
|
|
|
Graphics2D g2d = (Graphics2D) g; |
|
|
|
|
|
|
|
Stroke oldStroke = g2d.getStroke(); |
|
|
|
|
|
|
|
g2d.setStroke(new BasicStroke(2, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND)); |
|
|
|
|
|
|
|
g2d.setColor(new Color(51, 51, 51)); |
|
|
|
|
|
|
|
g2d.drawPolygon((Polygon) getShape4Board()); |
|
|
|
|
|
|
|
g2d.setStroke(oldStroke); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void initComponents() { |
|
|
|
protected void initComponents() { |
|
|
|
setUndecorated(true); |
|
|
|
setUndecorated(true); |
|
|
|
try { |
|
|
|
try { |
|
|
@ -318,7 +310,27 @@ public abstract class UIBubbleFloatPane<T> extends BasicBeanPane<T> { |
|
|
|
final JPanel contentPane = (JPanel) this.getContentPane(); |
|
|
|
final JPanel contentPane = (JPanel) this.getContentPane(); |
|
|
|
this.setLayout(null); |
|
|
|
this.setLayout(null); |
|
|
|
contentPane.add(UIBubbleFloatPane.this); |
|
|
|
contentPane.add(UIBubbleFloatPane.this); |
|
|
|
setVisible(true); |
|
|
|
contentPane.setBorder(new Border() { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { |
|
|
|
|
|
|
|
Graphics2D g2d = (Graphics2D) g; |
|
|
|
|
|
|
|
Stroke oldStroke = g2d.getStroke(); |
|
|
|
|
|
|
|
g2d.setStroke(new BasicStroke(2, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND)); |
|
|
|
|
|
|
|
g2d.setColor(new Color(51, 51, 51)); |
|
|
|
|
|
|
|
g2d.drawPolygon((Polygon) getShape4Board()); |
|
|
|
|
|
|
|
g2d.setStroke(oldStroke); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public Insets getBorderInsets(Component c) { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public boolean isBorderOpaque() { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|