forked from fanruan/finekit
richie
5 years ago
6 changed files with 211 additions and 7 deletions
@ -0,0 +1,84 @@
|
||||
package com.fanruan.api.design.ui.component; |
||||
|
||||
import javax.swing.event.MouseInputAdapter; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
import java.awt.event.MouseEvent; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @version 10.0 |
||||
* Created by richie on 2019-08-28 |
||||
* 可以点击的标签(带超链接效果) |
||||
*/ |
||||
public class UIActionLabel extends UILabel { |
||||
|
||||
private ActionListener actionListener; |
||||
|
||||
public UIActionLabel(String text) { |
||||
super(text); |
||||
|
||||
this.setForeground(Color.blue); |
||||
this.addMouseListener(mouseInputAdapter); |
||||
this.addMouseMotionListener(mouseInputAdapter); |
||||
} |
||||
|
||||
public void addActionListener(ActionListener actionListener) { |
||||
this.actionListener = actionListener; |
||||
} |
||||
|
||||
public void paintComponent(Graphics _gfx) { |
||||
super.paintComponent(_gfx); |
||||
|
||||
_gfx.setColor(Color.blue); |
||||
_gfx.drawLine(0, this.getHeight() - 1, this.getWidth(), this.getHeight() - 1); |
||||
} |
||||
|
||||
private MouseInputAdapter mouseInputAdapter = new MouseInputAdapter() { |
||||
public void mouseClicked(MouseEvent e) { |
||||
} |
||||
|
||||
public void mousePressed(MouseEvent e) { |
||||
} |
||||
|
||||
public void mouseReleased(MouseEvent evt) { |
||||
Object source = evt.getSource(); |
||||
|
||||
if (source instanceof UILabel) { |
||||
//Action.
|
||||
if (actionListener != null) { |
||||
ActionEvent actionEvent = new ActionEvent(source, 99, ""); |
||||
actionListener.actionPerformed(actionEvent); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public void mouseEntered(MouseEvent evt) { |
||||
Object source = evt.getSource(); |
||||
|
||||
if (source instanceof UILabel) { |
||||
((UILabel) source).setCursor(new Cursor(Cursor.HAND_CURSOR)); |
||||
} |
||||
} |
||||
|
||||
public void mouseExited(MouseEvent evt) { |
||||
Object source = evt.getSource(); |
||||
|
||||
if (source instanceof UILabel) { |
||||
((UILabel) source).setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); |
||||
} |
||||
} |
||||
|
||||
public void mouseDragged(MouseEvent e) { |
||||
} |
||||
|
||||
public void mouseMoved(MouseEvent evt) { |
||||
Object source = evt.getSource(); |
||||
|
||||
if (source instanceof UILabel) { |
||||
((UILabel) source).setCursor(new Cursor(Cursor.HAND_CURSOR)); |
||||
} |
||||
} |
||||
}; |
||||
} |
@ -0,0 +1,32 @@
|
||||
package com.fanruan.api.design.ui.component; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @version 10.0 |
||||
* Created by richie on 2019-08-28 |
||||
* 按钮组件 |
||||
*/ |
||||
public class UIButton extends com.fr.design.gui.ibutton.UIButton { |
||||
|
||||
public UIButton() { |
||||
super(); |
||||
} |
||||
|
||||
public UIButton(String text) { |
||||
super(text); |
||||
} |
||||
|
||||
public UIButton(Icon icon) { |
||||
super(icon); |
||||
} |
||||
|
||||
public UIButton(Action action) { |
||||
super(action); |
||||
} |
||||
|
||||
public UIButton(String text, Icon icon) { |
||||
super(text, icon); |
||||
} |
||||
} |
@ -0,0 +1,41 @@
|
||||
package com.fanruan.api.design.ui.component; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @version 10.0 |
||||
* Created by richie on 2019-08-28 |
||||
* 标签组件 |
||||
*/ |
||||
public class UILabel extends com.fr.design.gui.ilable.UILabel { |
||||
|
||||
public UILabel() { |
||||
|
||||
} |
||||
|
||||
public UILabel(String text) { |
||||
super(text); |
||||
} |
||||
|
||||
public UILabel(Icon icon) { |
||||
super(icon); |
||||
} |
||||
|
||||
public UILabel(String text, boolean enable) { |
||||
super(text, enable); |
||||
} |
||||
|
||||
public UILabel(String text, int align) { |
||||
super(text, align); |
||||
} |
||||
|
||||
public UILabel(Icon icon, int align) { |
||||
super(icon, align); |
||||
} |
||||
|
||||
public UILabel(String text, Icon icon, int align) { |
||||
super(text, icon, align); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,22 @@
|
||||
package com.fanruan.api.design.ui.component; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @version 10.0 |
||||
* Created by richie on 2019-08-28 |
||||
* 文本域组件 |
||||
*/ |
||||
public class UITextArea extends com.fr.design.gui.itextarea.UITextArea { |
||||
|
||||
public UITextArea() { |
||||
super(); |
||||
} |
||||
|
||||
public UITextArea(String text) { |
||||
super(text); |
||||
} |
||||
|
||||
public UITextArea(int rows, int columns) { |
||||
super(rows, columns); |
||||
} |
||||
} |
@ -0,0 +1,32 @@
|
||||
package com.fanruan.api.design.ui.component; |
||||
|
||||
import javax.swing.text.Document; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @version 10.0 |
||||
* Created by richie on 2019-08-28 |
||||
* 文本框组件 |
||||
*/ |
||||
public class UITextField extends com.fr.design.gui.itextfield.UITextField { |
||||
|
||||
public UITextField() { |
||||
|
||||
} |
||||
|
||||
public UITextField(int columns) { |
||||
super(columns); |
||||
} |
||||
|
||||
public UITextField(String text) { |
||||
super(text); |
||||
} |
||||
|
||||
public UITextField(String text, int columns) { |
||||
super(text, columns); |
||||
} |
||||
|
||||
public UITextField(Document document, String text, int columns) { |
||||
super(document, text, columns); |
||||
} |
||||
} |
@ -1,7 +0,0 @@
|
||||
package com.fanruan.api.layout; |
||||
import com.fr.design.layout.TableLayout; |
||||
|
||||
public class LayoutKit { |
||||
public static final double PREFERRED = TableLayout.PREFERRED; |
||||
public static final double FILL = TableLayout.FILL; |
||||
} |
Loading…
Reference in new issue