java计算两个日期相隔的天数
java计算两个日期相隔的天数
恒忍电话本1.0,使用java操作SQLite3,32位双击start32.bat,64位双击start64.bat,win7 64位和win xp测试通过
作为一名程序员,免不了要经常安装软件,若因安装软件破坏了系统,或者影响到其软件的使用,要重装系统,那就很费事了,所以在必要时,安装软件前先把系统盘和软件盘先Ghost一下。深山老林一键还原是我目前在使用的一个免费Ghost软件,用起来感觉还不错。
主要代码: BufferedImage bufImg = new BufferedImage(20, 20, BufferedImage.TYPE_INT_ARGB_PRE); Graphics2D g2d = bufImg.createGraphics(); FontMetrics fm = g2d.getFontMetrics(font); int strWidth = fm.stringWidth("编辑"); int opSpacing = (width - strWidth) / 3; panel.setLayout(null); editLabel.setBounds(opSpacing, 0, strWidth, 15); editLabel.setText("编辑"); editLabel.setFont(font); editLabel.setForeground(defColor); editLabel.addMouseListener(mouseL); panel.add(editLabel); int beginX = strWidth + opSpacing * 2; delLabel.setBounds(beginX, 0, strWidth, 15); delLabel.setText("删除"); delLabel.setFont(font); delLabel.setForeground(defColor); delLabel.addMouseListener(mouseL); panel.add(delLabel);
主要代码: DefaultTableModel model = (DefaultTableModel) table.getModel(); model.setColumnIdentifiers(new String[] {"标题一", "标题二", "标题三"});
java实现sqlite数据库的创建和增删查改的一个项目,项目为未完成的一个电话本记录系统,在电话本的分组中,已经都实现了数据库操作的增删查改(如果需要看实现增删查改的代码,需要查看电话本的分组功能)并且用util实现,可以复用。
java自定义弹窗Demo,主要代码: thisDialog = this; this.setTitle("提示"); this.setSize(300, 150); this.setModal(true); this.setLocationRelativeTo(c); actionL = new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { try { thisDialog.dispose(); } catch(Exception e) { System.out.println(e); } } }; Container container = getContentPane(); container.setLayout(null); Icon icon = new ImageIcon(ConfirmDialog.class.getClassLoader().getResource("info.png")); ScaleIcon scaleIcon = new ScaleIcon(icon); JLabel iconLabel = new JLabel(scaleIcon); iconLabel.setBounds(20, 20, 30, 30); container.add(iconLabel); JLabel msgLabel = new JLabel(); msgLabel.setText(msg); msgLabel.setBounds(60, 20, 240, 30); container.add(msgLabel); JButton btn = new JButton(); btn.setText("确定"); btn.setBounds(100, 60, 100, 30); btn.addActionListener(actionL); container.add(btn); this.setVisible(true);
主要代码: BufferedImage image = null; try { image = ImageIO.read(this.getClass().getResource("./logo.png")); this.setIconImage(image); } catch(Exception e) { System.out.println(e); }
主要代码: String cmd = ae.getActionCommand(); if (CMD_1.equals(cmd)) { // 设置按钮显示效果 UIManager.put("OptionPane.buttonFont", new FontUIResource(new Font("宋体", Font.ITALIC, 13))); // 设置文本显示效果 UIManager.put("OptionPane.messageFont", new FontUIResource(new Font("宋体", Font.ITALIC, 13))); JOptionPane.showMessageDialog(null, "我是用UIManager设置过的Dialog"); } else if (CMD_2.equals(cmd)) { // 确定按钮 JButton btnYes = new JButton("可以了哦"); btnYes.setFont(new Font("幼圆", Font.BOLD, 16)); btnYes.setForeground(Color.MAGENTA); // 否定按钮 JButton btnNo = new JButton("不行不行"); btnNo.setFont(new Font("幼圆", Font.ITALIC, 18)); btnNo.setForeground(Color.PINK); // 按钮选项加入数组 Object[] options = { btnYes, btnNo }; // 文本内容 JLabel label = new JLabel("我是加入了Label和JButton的Dialog这样可以吗?"); label.setForeground(Color.ORANGE); label.setFont(new Font("宋体", Font.ITALIC, 16)); // 显示Dialog JOptionPane.showOptionDialog(null, label, "标题", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]); } else if (CMD_3.equals(cmd)) { JOptionPane.showConfirmDialog(null, new JLabel("<html><h2><font color='blue'>你好</font><font color='#cc22ff'> 我是HTML实现的哦~</font></h2></html>"), "使用HTML!", JOptionPane.YES_NO_OPTION); }