文档章节

JAVA SWING 日期选择控件(目前支持JLable和JTextField http://zgdeng.iteye.com/blog/1405650

陈爱茹cx1992
 陈爱茹cx1992
发布于 2016/07/26 17:35
字数 1812
阅读 38
收藏 0
点赞 0
评论 0
原文  http://zgdeng.iteye.com/blog/1405650

import java.awt.BasicStroke;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.Point;
import java.awt.Polygon;
import java.awt.Stroke;
import java.awt.Toolkit;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
 
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.Popup;
import javax.swing.PopupFactory;
import javax.swing.SwingUtilities;
import javax.swing.event.AncestorEvent;
import javax.swing.event.AncestorListener;
 
/** 
 * 日期选择器,可以指定日期的显示格式 
 */
public class DateChooser extends JPanel {
 
private static final long serialVersionUID = 4529266044762990227L;
 
private Date initDate;
private Calendar now = Calendar.getInstance();
private Calendar select;
private JPanel monthPanel;//月历  
private JP1 jp1;//四块面板,组成  
private JP2 jp2;
private JP3 jp3;
private JP4 jp4;
private Font font = new Font("宋体", Font.PLAIN, 12);
private final LabelManager lm = new LabelManager();
private SimpleDateFormat sdf;
private boolean isShow = false;
private Popup pop;
 
private JComponent showDate;
 
public static DateChooser getInstance() {
return new DateChooser();
}
 
public static DateChooser getInstance(Date date) {
return new DateChooser(date);
}
 
public static DateChooser getInstance(String format) {
return new DateChooser(format);
}
 
public static DateChooser getInstance(Date date, String format) {
return new DateChooser(date, format);
}
 
/** 
 * Creates a new instance of DateChooser 
 */
private DateChooser() {
this(new Date());
}
 
private DateChooser(Date date) {
this(date, "yyyy年MM月dd日");
}
 
private DateChooser(String format) {
this(new Date(), format);
}
 
private DateChooser(Date date, String format) {
initDate = date;
sdf = new SimpleDateFormat(format);
select = Calendar.getInstance();
select.setTime(initDate);
initPanel();
}
 
/** 
 * 是否允许用户选择 
 */
public void setEnabled(boolean b) {
super.setEnabled(b);
showDate.setEnabled(b);
}
 
/** 
 *得到当前选择框的日期 
 */
public Date getDate() {
return select.getTime();
}
 
public String getStrDate() {
return sdf.format(select.getTime());
}
 
public String getStrDate(String format) {
sdf = new SimpleDateFormat(format);
return sdf.format(select.getTime());
}
 
//根据初始化的日期,初始化面板  
private void initPanel() {
monthPanel = new JPanel(new BorderLayout());
monthPanel.setBorder(BorderFactory.createLineBorder(Color.BLUE));
JPanel up = new JPanel(new BorderLayout());
up.add(jp1 = new JP1(), BorderLayout.NORTH);
up.add(jp2 = new JP2(), BorderLayout.CENTER);
monthPanel.add(jp3 = new JP3(), BorderLayout.CENTER);
monthPanel.add(up, BorderLayout.NORTH);
monthPanel.add(jp4 = new JP4(), BorderLayout.SOUTH);
this.addAncestorListener(new AncestorListener() {
public void ancestorAdded(AncestorEvent event) {
 
}
 
public void ancestorRemoved(AncestorEvent event) {
 
}
 
//只要祖先组件一移动,马上就让popup消失  
public void ancestorMoved(AncestorEvent event) {
hidePanel();
}
});
}
 
public void register(final JComponent showDate) {
this.showDate = showDate;
 
showDate.setRequestFocusEnabled(true);
showDate.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent me) {
showDate.requestFocusInWindow();
}
});
this.setBackground(Color.WHITE);
this.add(showDate, BorderLayout.CENTER);
this.setPreferredSize(new Dimension(90, 25));
this.setBorder(BorderFactory.createLineBorder(Color.GRAY));
showDate.addMouseListener(new MouseAdapter() {
public void mouseEntered(MouseEvent me) {
if (showDate.isEnabled()) {
showDate.setCursor(new Cursor(Cursor.HAND_CURSOR));
showDate.setForeground(Color.RED);
}
}
 
public void mouseExited(MouseEvent me) {
if (showDate.isEnabled()) {
showDate.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
showDate.setForeground(Color.BLACK);
}
}
 
public void mousePressed(MouseEvent me) {
if (showDate.isEnabled()) {
showDate.setForeground(Color.CYAN);
if (isShow) {
hidePanel();
} else {
showPanel(showDate);
}
}
}
 
public void mouseReleased(MouseEvent me) {
if (showDate.isEnabled()) {
showDate.setForeground(Color.BLACK);
}
}
});
showDate.addFocusListener(new FocusListener() {
public void focusLost(FocusEvent e) {
hidePanel();
}
 
public void focusGained(FocusEvent e) {
 
}
});
}
 
//根据新的日期刷新  
private void refresh() {
jp1.updateDate();
jp2.updateDate();
jp3.updateDate();
jp4.updateDate();
SwingUtilities.updateComponentTreeUI(this);
}
 
//提交日期  
private void commit() {
//TODO add other components here
if (showDate instanceof JTextField) {
((JTextField) showDate).setText(sdf.format(select.getTime()));
}else if (showDate instanceof JLabel) {
((JLabel) showDate).setText(sdf.format(select.getTime()));
}
 
hidePanel();
}
 
//隐藏日期选择面板  
private void hidePanel() {
if (pop != null) {
isShow = false;
pop.hide();
pop = null;
}
}
 
//显示日期选择面板  
private void showPanel(Component owner) {
if (pop != null) {
pop.hide();
}
Point show = new Point(0, showDate.getHeight());
SwingUtilities.convertPointToScreen(show, showDate);
Dimension size = Toolkit.getDefaultToolkit().getScreenSize();
int x = show.x;
int y = show.y;
if (x < 0) {
x = 0;
}
if (x > size.width - 295) {
x = size.width - 295;
}
if (y < size.height - 170) {
} else {
y -= 188;
}
pop = PopupFactory.getSharedInstance().getPopup(owner, monthPanel, x, y);
pop.show();
isShow = true;
}
 
/** 
 * 最上面的面板用来显示月份的增减 
 */
private class JP1 extends JPanel {
private static final long serialVersionUID = -5638853772805561174L;
JLabel yearleft, yearright, monthleft, monthright, center, centercontainer;
 
public JP1() {
super(new BorderLayout());
this.setBackground(new Color(160, 185, 215));
initJP1();
}
 
private void initJP1() {
yearleft = new JLabel("  <<", JLabel.CENTER);
yearleft.setToolTipText("上一年");
yearright = new JLabel(">>  ", JLabel.CENTER);
yearright.setToolTipText("下一年");
yearleft.setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
yearright.setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0));
 
monthleft = new JLabel("<", JLabel.RIGHT);
monthleft.setToolTipText("上一月");
monthright = new JLabel(">", JLabel.LEFT);
monthright.setToolTipText("下一月");
monthleft.setBorder(BorderFactory.createEmptyBorder(2, 30, 0, 0));
monthright.setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 30));
 
centercontainer = new JLabel("", JLabel.CENTER);
centercontainer.setLayout(new BorderLayout());
center = new JLabel("", JLabel.CENTER);
 
centercontainer.add(monthleft, BorderLayout.WEST);
centercontainer.add(center, BorderLayout.CENTER);
centercontainer.add(monthright, BorderLayout.EAST);
 
this.add(yearleft, BorderLayout.WEST);
this.add(centercontainer, BorderLayout.CENTER);
this.add(yearright, BorderLayout.EAST);
this.setPreferredSize(new Dimension(295, 25));
 
updateDate();
 
yearleft.addMouseListener(new MouseAdapter() {
public void mouseEntered(MouseEvent me) {
yearleft.setCursor(new Cursor(Cursor.HAND_CURSOR));
yearleft.setForeground(Color.RED);
}
 
public void mouseExited(MouseEvent me) {
yearleft.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
yearleft.setForeground(Color.BLACK);
}
 
public void mousePressed(MouseEvent me) {
select.add(Calendar.YEAR, -1);
yearleft.setForeground(Color.WHITE);
refresh();
}
 
public void mouseReleased(MouseEvent me) {
yearleft.setForeground(Color.BLACK);
}
});
yearright.addMouseListener(new MouseAdapter() {
public void mouseEntered(MouseEvent me) {
yearright.setCursor(new Cursor(Cursor.HAND_CURSOR));
yearright.setForeground(Color.RED);
}
 
public void mouseExited(MouseEvent me) {
yearright.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
yearright.setForeground(Color.BLACK);
}
 
public void mousePressed(MouseEvent me) {
select.add(Calendar.YEAR, 1);
yearright.setForeground(Color.WHITE);
refresh();
}
 
public void mouseReleased(MouseEvent me) {
yearright.setForeground(Color.BLACK);
}
});
monthleft.addMouseListener(new MouseAdapter() {
public void mouseEntered(MouseEvent me) {
monthleft.setCursor(new Cursor(Cursor.HAND_CURSOR));
monthleft.setForeground(Color.RED);
}
 
public void mouseExited(MouseEvent me) {
monthleft.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
monthleft.setForeground(Color.BLACK);
}
 
public void mousePressed(MouseEvent me) {
select.add(Calendar.MONTH, -1);
monthleft.setForeground(Color.WHITE);
refresh();
}
 
public void mouseReleased(MouseEvent me) {
monthleft.setForeground(Color.BLACK);
}
});
monthright.addMouseListener(new MouseAdapter() {
public void mouseEntered(MouseEvent me) {
monthright.setCursor(new Cursor(Cursor.HAND_CURSOR));
monthright.setForeground(Color.RED);
}
 
public void mouseExited(MouseEvent me) {
monthright.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
monthright.setForeground(Color.BLACK);
}
 
public void mousePressed(MouseEvent me) {
select.add(Calendar.MONTH, 1);
monthright.setForeground(Color.WHITE);
refresh();
}
 
public void mouseReleased(MouseEvent me) {
monthright.setForeground(Color.BLACK);
}
});
}
 
private void updateDate() {
center.setText(select.get(Calendar.YEAR) + "年" + (select.get(Calendar.MONTH) + 1) + "月");
}
}
 
private class JP2 extends JPanel {
private static final long serialVersionUID = -8176264838786175724L;
 
public JP2() {
this.setPreferredSize(new Dimension(295, 20));
}
 
protected void paintComponent(Graphics g) {
g.setFont(font);
g.drawString("日 一 二 三 四 五 六", 5, 10);
g.drawLine(0, 15, getWidth(), 15);
}
 
private void updateDate() {
 
}
}
 
private class JP3 extends JPanel {
private static final long serialVersionUID = 43157272447522985L;
 
public JP3() {
super(new GridLayout(6, 7));
this.setPreferredSize(new Dimension(295, 100));
initJP3();
}
 
private void initJP3() {
updateDate();
}
 
public void updateDate() {
this.removeAll();
lm.clear();
Date temp = select.getTime();
Calendar select = Calendar.getInstance();
select.setTime(temp);
select.set(Calendar.DAY_OF_MONTH, 1);
int index = select.get(Calendar.DAY_OF_WEEK);
int sum = (index == 1 ? 8 : index);
select.add(Calendar.DAY_OF_MONTH, 0 - sum);
for (int i = 0; i < 42; i++) {
select.add(Calendar.DAY_OF_MONTH, 1);
lm.addLabel(new MyLabel(select.get(Calendar.YEAR), select.get(Calendar.MONTH), select.get(Calendar.DAY_OF_MONTH)));
}
for (MyLabel my : lm.getLabels()) {
this.add(my);
}
select.setTime(temp);
}
}
 
private class MyLabel extends JLabel implements Comparator<MyLabel>, MouseListener, MouseMotionListener {
private static final long serialVersionUID = 3668734399227577214L;
private int year, month, day;
private boolean isSelected;
 
public MyLabel(int year, int month, int day) {
super("" + day, JLabel.CENTER);
this.year = year;
this.day = day;
this.month = month;
this.addMouseListener(this);
this.addMouseMotionListener(this);
this.setFont(font);
if (month == select.get(Calendar.MONTH)) {
this.setForeground(Color.BLACK);
} else {
this.setForeground(Color.LIGHT_GRAY);
}
if (day == select.get(Calendar.DAY_OF_MONTH)) {
this.setBackground(new Color(160, 185, 215));
} else {
this.setBackground(Color.WHITE);
}
}
 
public boolean getIsSelected() {
return isSelected;
}
 
public void setSelected(boolean b, boolean isDrag) {
isSelected = b;
if (b && !isDrag) {
int temp = select.get(Calendar.MONTH);
select.set(year, month, day);
if (temp == month) {
SwingUtilities.updateComponentTreeUI(jp3);
} else {
refresh();
}
}
this.repaint();
}
 
protected void paintComponent(Graphics g) {
if (day == select.get(Calendar.DAY_OF_MONTH) && month == select.get(Calendar.MONTH)) {
//如果当前日期是选择日期,则高亮显示  
g.setColor(new Color(160, 185, 215));
g.fillRect(0, 0, getWidth(), getHeight());
}
if (year == now.get(Calendar.YEAR) && month == now.get(Calendar.MONTH) && day == now.get(Calendar.DAY_OF_MONTH)) {
//如果日期和当前日期一样,则用红框  
Graphics2D gd = (Graphics2D) g;
gd.setColor(Color.RED);
Polygon p = new Polygon();
p.addPoint(0, 0);
p.addPoint(getWidth() - 1, 0);
p.addPoint(getWidth() - 1, getHeight() - 1);
p.addPoint(0, getHeight() - 1);
gd.drawPolygon(p);
}
if (isSelected) {//如果被选中了就画出一个虚线框出来  
Stroke s = new BasicStroke(1.0f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL, 1.0f, new float[] { 2.0f, 2.0f }, 1.0f);
Graphics2D gd = (Graphics2D) g;
gd.setStroke(s);
gd.setColor(Color.BLACK);
Polygon p = new Polygon();
p.addPoint(0, 0);
p.addPoint(getWidth() - 1, 0);
p.addPoint(getWidth() - 1, getHeight() - 1);
p.addPoint(0, getHeight() - 1);
gd.drawPolygon(p);
}
super.paintComponent(g);
}
 
public boolean contains(Point p) {
return this.getBounds().contains(p);
}
 
private void update() {
repaint();
}
 
public void mouseClicked(MouseEvent e) {
}
 
public void mousePressed(MouseEvent e) {
isSelected = true;
update();
}
 
public void mouseReleased(MouseEvent e) {
Point p = SwingUtilities.convertPoint(this, e.getPoint(), jp3);
lm.setSelect(p, false);
commit();
}
 
public void mouseEntered(MouseEvent e) {
}
 
public void mouseExited(MouseEvent e) {
}
 
public void mouseDragged(MouseEvent e) {
Point p = SwingUtilities.convertPoint(this, e.getPoint(), jp3);
lm.setSelect(p, true);
}
 
public void mouseMoved(MouseEvent e) {
}
 
public int compare(MyLabel o1, MyLabel o2) {
Calendar c1 = Calendar.getInstance();
c1.set(o1.year, o2.month, o1.day);
Calendar c2 = Calendar.getInstance();
c2.set(o2.year, o2.month, o2.day);
return c1.compareTo(c2);
}
}
 
private class LabelManager {
private List<MyLabel> list;
 
public LabelManager() {
list = new ArrayList<MyLabel>();
}
 
public List<MyLabel> getLabels() {
return list;
}
 
public void addLabel(MyLabel my) {
list.add(my);
}
 
public void clear() {
list.clear();
}
 
@SuppressWarnings("unused")
public void setSelect(MyLabel my, boolean b) {
for (MyLabel m : list) {
if (m.equals(my)) {
m.setSelected(true, b);
} else {
m.setSelected(false, b);
}
}
}
 
public void setSelect(Point p, boolean b) {
//如果是拖动,则要优化一下,以提高效率  
if (b) {
//表示是否能返回,不用比较完所有的标签,能返回的标志就是把上一个标签和  
//将要显示的标签找到了就可以了  
boolean findPrevious = false, findNext = false;
for (MyLabel m : list) {
if (m.contains(p)) {
findNext = true;
if (m.getIsSelected()) {
findPrevious = true;
} else {
m.setSelected(true, b);
}
} else if (m.getIsSelected()) {
findPrevious = true;
m.setSelected(false, b);
}
if (findPrevious && findNext) {
return;
}
}
} else {
MyLabel temp = null;
for (MyLabel m : list) {
if (m.contains(p)) {
temp = m;
} else if (m.getIsSelected()) {
m.setSelected(false, b);
}
}
if (temp != null) {
temp.setSelected(true, b);
}
}
}
 
}
 
private class JP4 extends JPanel {
private static final long serialVersionUID = -6391305687575714469L;
 
public JP4() {
super(new BorderLayout());
this.setPreferredSize(new Dimension(295, 20));
this.setBackground(new Color(160, 185, 215));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
final JLabel jl = new JLabel("今天: " + sdf.format(new Date()));
jl.setToolTipText("点击选择今天日期");
this.add(jl, BorderLayout.CENTER);
jl.addMouseListener(new MouseAdapter() {
public void mouseEntered(MouseEvent me) {
jl.setCursor(new Cursor(Cursor.HAND_CURSOR));
jl.setForeground(Color.RED);
}
 
public void mouseExited(MouseEvent me) {
jl.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
jl.setForeground(Color.BLACK);
}
 
public void mousePressed(MouseEvent me) {
jl.setForeground(Color.WHITE);
select.setTime(new Date());
refresh();
commit();
}
 
public void mouseReleased(MouseEvent me) {
jl.setForeground(Color.BLACK);
}
});
}
 
private void updateDate() {
 
}
}
 
public static void main(String[] args) {
DateChooser dateChooser1 = DateChooser.getInstance("yyyy-MM-dd");
DateChooser dateChooser2 = DateChooser.getInstance("yyyy-MM-dd");
JTextField showDate1 = new JTextField("单击选择日期");
JLabel showDate2 = new JLabel("单击选择日期");
 
dateChooser1.register(showDate1);
dateChooser2.register(showDate2);
 
JFrame jf = new JFrame("测试日期选择器");
jf.add(showDate1, BorderLayout.NORTH);
jf.add(showDate2, BorderLayout.SOUTH);
jf.pack();
jf.setLocationRelativeTo(null);
jf.setVisible(true);
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}

本文转载自:http://blog.csdn.net/ruru7989/article/details/23201833

共有 人打赏支持
陈爱茹cx1992
粉丝 0
博文 59
码字总数 0
作品 0
济南
程序员
14.4-全栈Java笔记: javax.swing常用控件有哪些?怎么用?

常用基本控件 javax.swing.JButton 在图形界面程序中,按钮可能是使用量最大的控件之一,javax.swing包中JButton类就是用来创建按钮的。如表1所示,为JButton常用的构造方法。 javax.swing....

全栈Java
06/26
0
0
SWT、Swing 或 AWT:哪个更适合您?

在为新应用程序选择 GUI 工具包时应该考虑哪些因素? Barry Feigenbaum (feigenba@us.ibm.com), 编程顾问, IBM 本文通过对 Eclipse 的 SWT 和 Java Swing、Abstract Windows Toolkit(AWT)G...

晨曦之光
2012/03/09
0
0
JComponentPack3.0正式发布

奇新Java控件---Java控件提供商和Java RIA, Web, J2ME解决方案开发商 我们为您提供了一系列方便易用的Java控件,帮助开发人员提高工作效率,加快开发进程。 最新动态: JComponentPack3.0正式...

fralepg
2009/04/11
0
0
Java 8新特性探究(十三)JavaFX 8新特性以及开发2048游戏

JavaFX主要致力于富客户端开发,以弥补swing的缺陷,主要提供图形库与media库,支持audio,video,graphics,animation,3D等,同时采用现代化的css方式支持界面设计。同时又采用XUI方式以XML方式...

OSC闲人
2014/10/19
0
28
Java IDE 之 JBuilder PK Eclipse

首先介绍一下Eclipse和JBuilder。 Borland JBuilder是业界领先的Java可视化开发环境,可用于构建基于Java 2平台的应用程序、Applets、JSP/Serverlets、JavaBeans TM、Enterprise JavaBeans,...

delmore
2010/09/30
0
0
GUI开发之AWT、SWING、SWT和JFACE的比较

核心提示:AWT Abstract Windows Toolkit(AWT)是最原始的 Java GUI 工具包。在任何一个 Java 运行环境中都可以使用它。 AWT 是一个非常简单的具有有限 GUI 组件、布局管理器和事件的工具包...

AlphaJay
2010/07/23
0
0
介绍JComponentPack产品中的AComboBox控件

Introduce the AComboBox component OverviewThe AComboBox is a drop down component in JComponentPack product, it’s different with the “JComboBox” component in the core Java swi......

fralepg
2009/02/21
0
0
介绍几种方法将Excel格式的文件导入到JTable中

How to import Excel file into JTable Here are three way to do this. The first and second the way will run in the background thread, the third way will run in current thread. 1. ......

fralepg
2009/02/21
0
0
做几道基础的Java测试题,看看最近有进步吗?欢迎来学习

Java是一种可以撰写跨平台应用软件的面向对象的程序设计语言。Java 技术具有卓越的通用性、高效性、平台移植性和安全性,广泛应用于PC、数据中心、游戏控制台、科学超级计算机、移动电话和互...

启示录是真的
05/24
0
0
NetBeans 新闻 Issue # 420 - Dec 15, 2009

2009-12-16 预览版:JavaFX Composer 插件 JavaFX Composer 是 一个用于创建JavaFX应用程序的可视化布局工具。有了这个工具,JavaFX开发人员可以创建标准JavaFX控件以及使用状态的GUIs来定义...

晨曦之光
2012/03/09
0
0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

用axios.all处理并发请求

如果我们需用在两个接口同时完成后在执行一些逻辑,我们可以使用axios.all处理并发请求: function getUserAccount() { return axios.get('/user/12345');}function getUserPermissio...

JamesView
32分钟前
0
0
SpringCloud 微服务 (十六) 服务追踪 Zipkin

问题 在服务中,有一个接口,该A接口中又调用了其他服务的B、C、D接口,出现一个请求耗时大的问题,这时候并不知道该B、C、D接口中哪个接口造成的耗时量,然后比如确定C服务接口出现的耗时量大,但...

___大侠
42分钟前
0
0
Java面试基础篇——第八篇:抽象类与接口的区别

1.抽象类 抽象类:如果一个类中包含有抽象方法,或这个类使用abstract关键字修饰,则称这个类是抽象类。 抽象方法是什么呢?抽象方法就是指用abstract关键字修饰的方法。 需要注意的是:抽象...

developlee的潇洒人生
59分钟前
2
0
jsoup 相关资料

1.jsoup 2.Jsoup概述 3.jsoup入门 4.jsoup Java HTML Parser 1.11.3 API

IT追寻者
今天
0
0
JPA @MappedSuperclass 注解说明

基于代码复用和模型分离的思想,在项目开发中使用JPA的@MappedSuperclass注解将实体类的多个属性分别封装到不同的非实体类中。 1.@MappedSuperclass注解只能标准在类上:@Target({java.lang....

海博1600
今天
0
0
【一】Scala Configuration 相关API

Play使用了 Typesafe config library,但是也提供了一个有着更多Scala高级特性的的 Configuration 封装。不熟悉Typesafe配置的开发者可以移步 configuration文件的语法和特性文档。 读取配置...

Landas
今天
3
0
使用cookie技术 记住账号

1. 效果 2. 实现过程 2.1 前端 将用户的选中传递给后台 这个参数的获取是 参考:https://my.oschina.net/springMVCAndspring/blog/1860498 // var rememberLogin = $("#rememberLoginId").i...

Lucky_Me
今天
1
0
《趣谈网络协议》02之网络分层的真实含义

一、提出问题 1.提出问题 当你听到什么二层设备、三层设备、四层 LB 和七层 LB 中层的时候,是否有点一头雾水,不知道这些所谓的层,对应的各种协议具体要做什么“工作”? 2.这四个问题你弄...

aibinxiao
今天
2
0
Python3学习日志二 Python中的集合set和字典dict

1.集合set 定义一个集合set 我们可以看到定义集合set有两种不同的形式,如果要定义一个空的集合set不能用{}而是要用set();另外,集合是无序的,而且set中的元素是不可重复的,如果你定义了一...

Mr_bullshit
今天
0
0
adb 操作指令详解

ADB,即 Android Debug Bridge,它是 Android 开发/测试人员不可替代的强大工具,也是 Android 设备玩家的好玩具。 注:有部分命令的支持情况可能与 Android 系统版本及定制 ROM 的实现有关。...

孟飞阳
今天
1
0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

返回顶部
顶部