- 浏览: 127888 次
- 性别:
- 来自: 北京
最新评论
-
C_J:
有必要这么鸡冻咩?
编写自己的ClassLoader知识点 -
jason61719:
你这不是说了等于没说吗……就解析个loadClass(),谁不 ...
编写自己的ClassLoader知识点 -
jiming:
tedeyang 写道很好的改进,不过话说回来,mybatis ...
开源,从关注产品社区做起(ibatis3.x的最近一个issue展示) -
C_J:
独爱Java 写道好像实际用处并不是很大,只是多了解了有这个东 ...
Java内存模型笔记 -
独爱Java:
好像实际用处并不是很大,只是多了解了有这个东西而已。。。
Java内存模型笔记
@Author:cjcj cj.yangjun@gmail.com <c-j.iteye.com>
CRL给的我第2次的笔试机会,但面试的时候没发挥好,且过几个月就毕业等客观原因被刷了。题目不难,主要看代码风格和组织结构,听说TW还有pair program,汗。代码贴这了,因为简历上有写这里的BLOG地址,可能需要看看代码风格什么的。废话不说,贴代码了。
题目:日历
效果图:
CRL给的我第2次的笔试机会,但面试的时候没发挥好,且过几个月就毕业等客观原因被刷了。题目不难,主要看代码风格和组织结构,听说TW还有pair program,汗。代码贴这了,因为简历上有写这里的BLOG地址,可能需要看看代码风格什么的。废话不说,贴代码了。
题目:日历
效果图:
/* * @(#)CanlendarColor.java 1.1 08/12/30 * Copyright 2008 by CJ. All rights reserved. * This is a color management, involving all the UI of the color defined. * These color are used to be called by other class. */ package Calendar.Common; import java.awt.Color; /** * Description:The CanlendarColor class is used to set the control's color. * All the variables are set to static, * so variables will be the beginning of the proceedings in the run-time initialization. * Interface manages all the colors. Increased scalability of the code. **/ public class CanlendarColor { /** IBM is the blue, so the calendar's background has become blue */ public static Color backGroundColor = Color.blue; /** The following are the main panel (MainPanel.java achieve) the color settings, * including the weekend color, font color, the color of the box, etc. */ public static Color palletTableColor = Color.white; public static Color selectedBackColor = Color.orange; public static Color weekFontColor = Color.white; public static Color dateFontColor = Color.black; public static Color weekendFontColor = Color.red; /** The following are the main control panel (ControlPanel.java) color management */ public static Color controlcolor = Color.white; public static Color cfgTextColor = Color.black; public static Color rbBorderColor = Color.blue; public static Color rbFontColor = Color.black; public static Color rbButtonColor = Color.white; public static Color rbBtFontColor = Color.black; }
/* * @(#)MyControlButton.java 1.1 08/12/30 * Copyright 2008 by CJ. All rights reserved. * Including a label and two button to control date. */ package Calendar.Common; import java.awt.*; import javax.swing.JPanel; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.border.LineBorder; /** * Class <code>ControlButton</code> is the root of the class hierarchy. * * @author cj */ public class MyControlButton extends JPanel { private static final long serialVersionUID = 1L; /** * the minimum value * In each of the buttons on the button, * the button is on the definition of a maximum or minimum value, * based on the value of the display to limit the maximum */ public int min = 0; /** * the maximum value */ public int max = 0; /** * the current value */ public int now = 0; /** * the down_button * For the year, month, day to increase */ public JButton buttonDOWN = null; /** * the up_button * For the year, month, day to reduce */ public JButton buttonUP = null; /** * the display label * Used to display the current value of the label */ public JLabel labelDateNum= null; private Font font = new Font("宋体", Font.PLAIN, 12); /** * the content panel */ private JPanel panelContent = null; /** * Description :The class Construction;Set the 'now','max','min' value * @param int * now value * @param int * min value * */ public MyControlButton(int now, int min, int max) { if (now >= min && now <= max) { this.now = now; this.min = min; this.max = max; } initControls(); } /** * Description :this method is used to init all control including one label and two button. */ private void initControls() { this.setLayout(new FlowLayout(1, 2, 1)); this.setBackground(CanlendarColor.controlcolor); labelDateNum = new JLabel("", JLabel.CENTER); /** * set the default value,This value is now decided by the parameters now. */ labelDateNum.setText("" + now); /** * set border */ labelDateNum.setBorder(new LineBorder(CanlendarColor.rbBorderColor, 1)); /** * set the foreground color */ labelDateNum.setForeground(CanlendarColor.rbFontColor); /** * set the position */ labelDateNum.setPreferredSize(new Dimension(35, 15)); /** * set the font */ labelDateNum.setFont(font); buttonUP = new JButton("^"); buttonUP.setBorder(new LineBorder(CanlendarColor.rbBorderColor, 1)); buttonUP.setBackground(CanlendarColor.rbButtonColor); buttonUP.setForeground(CanlendarColor.rbBtFontColor); buttonUP.setPreferredSize(new Dimension(15, 10)); buttonUP.setFont(font); /** * Don't allow to be focused */ buttonUP.setFocusable(false); buttonDOWN = new JButton("v"); buttonDOWN.setBorder(new LineBorder(CanlendarColor.rbBorderColor, 1)); buttonDOWN.setBackground(CanlendarColor.rbButtonColor); buttonDOWN.setForeground(CanlendarColor.rbBtFontColor); buttonDOWN.setPreferredSize(new Dimension(15, 10)); buttonDOWN.setFont(font); buttonDOWN.setFocusable(false); /** * Load control into panel */ add(labelDateNum); add(getPanel()); } /** * Description :this method is used to init the panel. */ public JPanel getPanel() { if (null == panelContent) { /** * set the content panel properties */ panelContent = new JPanel(new BorderLayout(0, 2)); panelContent.add(buttonUP, BorderLayout.CENTER); panelContent.add(buttonDOWN, BorderLayout.SOUTH); } return panelContent; } }
/* * @(#)MainFrame.java 1.1 08/12/30 * Copyright 2008 by CJ. All rights reserved. * This is the main frame including the ok_button,cancel_button and the main panel. * */ package Calendar.MainFrame; import java.awt.BorderLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.GregorianCalendar; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.SwingUtilities; import javax.swing.border.LineBorder; import Calendar.Common.CanlendarColor; import Calendar.Panels.MainTablePanel; public class MainFrame extends JFrame{ /** * Description:This is the main type of interface, and show that he was responsible for loading the main panel. * Add another 2 button and some personal info * The main task is to load objects main panel. The main panel is the main form of the calendar. **/ private static final long serialVersionUID = 1L; /** * The Calendar class is an abstract class that provides methods for converting * between a specific instant in time and a set of fields calendar fields * such as YEAR, MONTH, DAY_OF_MONTH, HOUR, and so on, and for manipulating * the calendar fields, such as getting the date of the next week. * An instant in time can be represented by a millisecond value that * is an offset from the Epoch, January 1, 1970 00:00:00.000 GMT (Gregorian). */ private Calendar currentMonth = new GregorianCalendar(); /** * This is the main form of the calendar * he needs to be used to initialize the table values from the object Calendar. * Translate the handle of the main window in order to account when the table when double-click the cell to control * and than control the window. * */ private MainTablePanel tablePanel = new MainTablePanel(this, currentMonth); /** the Frame's content panel */ private JPanel panelContent = null; /** OK Button */ private JButton buttonOK = null; /** Cancel Button */ private JButton buttonCancel = null; /** The selected date text field that tell the now date */ public JTextField textDate = null; /** * Description :Construction.Call anther function named init() */ public MainFrame() { super(); initControls(); } /** * Description :this init() method is used to init all control including buttons and text field */ private void initControls() { /** * set the frame title */ setTitle("Calendar by CJ for resume.Email:cj.yangjun@gmail.com"); /** * set the size */ setSize(400, 200); /** * set the button name */ buttonOK = new JButton("Ok"); /** * set the border */ buttonOK.setBorder(new LineBorder(CanlendarColor.rbBorderColor, 1)); /** * set the background color */ buttonOK.setBackground(CanlendarColor.rbButtonColor); /** * set the foreground color */ buttonOK.setForeground(CanlendarColor.rbBtFontColor); buttonCancel = new JButton("Cancel"); buttonCancel.setBorder(new LineBorder(CanlendarColor.rbBorderColor, 1)); buttonCancel.setBackground(CanlendarColor.rbButtonColor); buttonCancel.setForeground(CanlendarColor.rbBtFontColor); textDate = new JTextField(); textDate.setEditable(false); /** * set the JTextField text. */ textDate.setText("The Selected Date is:" + new SimpleDateFormat("dd-MM-yyyy").format(tablePanel.getDate())); /** * add the content panel. */ getContentPane().add(getContentPanel(), BorderLayout.CENTER); /** * add the Listener function */ addListener(); } private JPanel getContentPanel() { if (null == panelContent) { /** * init the content panel about border,background,add(). */ panelContent = new JPanel(new BorderLayout(), true); panelContent.setBorder(new LineBorder(CanlendarColor.backGroundColor, 2)); panelContent.setBackground(CanlendarColor.backGroundColor); panelContent.add(tablePanel, BorderLayout.CENTER); panelContent.add(buttonOK, BorderLayout.WEST); panelContent.add(buttonCancel, BorderLayout.EAST); panelContent.add(textDate, BorderLayout.NORTH); } return panelContent; } /** * Description :this addListener() method is used to response the buttonOK and buttonCancel. * setting the current date from the other method tablePanel.getDate(). */ private void addListener() { buttonCancel.addMouseListener(new MouseAdapter() { /** * mouse pressed on buttonCancel */ public void mousePressed(MouseEvent e) { /** * exit the program */ dispose(); } }); buttonOK.addMouseListener(new MouseAdapter() { /** * mouse pressed on buttonOK */ public void mousePressed(MouseEvent e) { /** * set the value from MainPanel's method getDate(). * Access to up-to-date period, and then update the information */ textDate.setText( "The Selected Date is:" + new SimpleDateFormat("dd-MM-yyyy").format(tablePanel.getDate())); } }); } /** * Description :main() method is the program beginning. */ public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { /** * new Frame object and show frame */ MainFrame app = new MainFrame(); app.setVisible(true); } }); } }
/* * @(#)MainPanel.java 1.1 08/12/30 * Copyright 2008 by CJ. All rights reserved. * This is the main panel including the calendar table. */ package Calendar.Panels; import java.awt.*; import java.awt.event.*; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTable; import javax.swing.table.*; import Calendar.Common.CanlendarColor; import Calendar.Common.MonthMaker; import Calendar.MainFrame.MainFrame; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; /** * Description:The MainPanel class is used to init and refresh the month by the Calendar Object from the class named ControlPane * this is the main panel of calendar,the main function is to define forms, real-time operating table set, * and in response to legitimate click the mouse and double-click the mouse incident events. * Click the mouse events need to amend the control panel (ControlPanel.java) of the label, it needs to be ControlPanel control. * Double-click the mouse events need to amend the main frame (MainFrame.java) of the label, it needs to be MainFrame control. * **/ public class MainTablePanel extends JPanel { private static final long serialVersionUID = 1L; /** * the handle of mainframe */ private MainFrame frameCalendar = null; /** * the Calendar Object */ private Calendar calendarCurrent = null; /** * define table head info */ private String[] calendarHead = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; private ControlButtonPanel myControlButton = null; /** * used to store the month values */ private String[][] calendarDate = new String[7][7]; /** * the value of selected row */ private int selectedRow; /** * the value of selected column */ private int selectedColumn; private DefaultTableModel model = null; /** * the main table object */ private JTable table = null; /** * Description :Construction * @param MainFrame: is the handle of mainframe used to set the JTextField */ public MainTablePanel(MainFrame mainframe, Calendar calendarCurrent) { /** * get the handle of frame */ this.frameCalendar = mainframe; /** * get the value of calendar */ this.calendarCurrent = calendarCurrent; initControls(); addListener(); } @SuppressWarnings("serial") /** * set the talel model */ private DefaultTableModel getTalbeModel() { if (null == model) { model = new DefaultTableModel(calendarDate, calendarHead) { public boolean isCellEditable(int rowIndex, int mColIndex) { return false; } }; } return model; } /** * Description :this init() method is used to init the table control and myControlButton control. */ @SuppressWarnings("serial") private void initControls(){ /** * define ContralPanel */ myControlButton=new ControlButtonPanel(this, calendarCurrent); /** * set the table head */ calendarDate[0][0] = "Sun"; calendarDate[0][1] = "Mon"; calendarDate[0][2] = "Tue"; calendarDate[0][3] = "Wed"; calendarDate[0][4] = "Thu"; calendarDate[0][5] = "Fri"; calendarDate[0][6] = "Sat"; /** * init the table */ table = new JTable(getTalbeModel()); DefaultTableCellRenderer tcr = new DefaultTableCellRenderer() { /** * set the cell of table and fill the color */ public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int temprow, int tempcolumn) { setHorizontalAlignment(JLabel.CENTER); if (temprow == 0) setBackground(CanlendarColor.backGroundColor); else if (temprow == selectedRow && tempcolumn == selectedColumn) { setBackground(CanlendarColor.selectedBackColor); } else setBackground(CanlendarColor.palletTableColor); if ((tempcolumn == 0 && temprow != 0) || (tempcolumn == 6 && temprow != 0)) setForeground(CanlendarColor.weekendFontColor); else if (temprow != 0 && tempcolumn != 0 && tempcolumn != 6) setForeground(CanlendarColor.dateFontColor); else setForeground(CanlendarColor.weekFontColor); return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, temprow, tempcolumn); } }; /** * refresh the cell */ for (int i = 0; i < calendarHead.length; i++) { table.getColumn(calendarHead[i]).setCellRenderer(tcr); } /** * Don't allowed the row to be selected */ table.setRowSelectionAllowed(false); /** * call another method setMonth in this file */ setMonth(calendarCurrent); setLayout(new BorderLayout()); /** * add all controls into the panel */ add(table, BorderLayout.CENTER); add(myControlButton, BorderLayout.NORTH); } /** * Description :this addListener() method is used to response the action by the mouse pressed and set the legal date */ private void addListener(){ table.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { try { /** * single click ,change the legal day in the myButton object */ if (e.getClickCount() == 1) { selectedRow = table.getSelectedRow(); selectedColumn = table.getSelectedColumn(); if (selectedRow > 0&& !calendarDate[selectedRow][selectedColumn].equals("")) { calendarCurrent.set(Calendar.DAY_OF_MONTH, Integer.valueOf(calendarDate[selectedRow][selectedColumn]).intValue()); myControlButton.setDay(Integer.valueOf(calendarDate[selectedRow][selectedColumn]).intValue()); } } else if (2 == e.getClickCount()) { /** * double click , change the TextField context in Frame */ frameCalendar.textDate.setText("The Selected Date is:"+ new SimpleDateFormat("dd-MM-yyyy").format(getDate())); } } catch (Exception ce) { ce.printStackTrace(); } } }); } /** * Description :this setMonth() method is used to call another method named 'monthMaker()' in MonthMaker.java * and receive 2-dimensional array to refresh the table content. * @param:Calendar: */ public void setMonth(Calendar calendarCurrent) { /** * get the calendar handle */ this.calendarCurrent = calendarCurrent; /** * get the new value used to refresh table */ String[][] tmpDate = MonthMaker.monthMaker(calendarCurrent); /** * init the table again */ for (int i = 1; i < 7; i++) for (int j = 0; j < 7; j++) { calendarDate[i][j] = tmpDate[i - 1][j]; table.setValueAt("" + tmpDate[i - 1][j], i, j); } } /** * Description :this getDate() method is used to return the value from the method getDate() in ControlPanel.java *@return Date: return the current date. */ public Date getDate(){ return myControlButton.getDate(); } }
发表评论
-
iOS入门(ongoing)
2012-09-13 11:32 1301Record it: The overview of ... -
Stuff about Android
2011-07-09 16:15 1065Foreword: long time ... -
JQuery初体验(Demo)
2011-05-22 13:43 1458Demo:Show <meta content ... -
Java内存模型笔记
2011-04-13 15:48 1538题记: 看到C/C++ ... -
Radiant_The Popular Ruby's CMS Demo篇
2011-04-02 14:49 1241题记: 上篇 记录我第一次安装Rodiant经过和 ... -
Radiant_The Popular Ruby’s CMS安装篇
2011-03-28 00:48 1278题记: 今天第一次参加JE的线下活动,robbin等 ... -
关于Azul 并发垃圾回收器
2011-03-26 14:40 1317题记: 总感觉JE讨论的帖子的东西都比较滞后,所以会 ... -
phpCMS & jQuery是我该做的(阉割了)
2011-02-27 23:02 81WD讲究以plugin挂载为结构,我需要构造一个p ... -
我的玩意:J2ME的Criteria初探
2011-01-20 21:59 1019题记: 前几天跟初中同学聊天,他问我能不能做一个GP ... -
编写自己的ClassLoader知识点
2011-01-13 14:41 1871题记: 看到InfoQ关于ClassLoader的文 ... -
周末好玩,用短信控制你的计算机
2011-01-10 16:34 2986Snapshot: 详情 ... -
About Dock Plugin on Mac
2010-11-21 22:47 1463题记: 第一次接触MAC的开发..... ... -
可变hashcode的隐患和序列化安全
2010-10-25 00:55 1369可变hashcode的隐患 为识别对象,JDK ... -
体验OSGi(helloworld.jar)—富app的热拔插
2010-10-18 23:22 2436记得以前工作的时候,有天direct manager问 ... -
MongoDB on DAO with Java Language
2010-08-26 19:17 1426A Quick Tour Using the Java d ... -
Getting Start on Mongodb
2010-08-26 01:29 1505题记: 最近老和同学聊到non-relational ... -
Java Media Framework本地玩转摄像头
2010-08-04 00:57 17351、简介The JavaTM Media Framework ... -
从WeakLogHandler应用看Java的引用、引用队列
2010-06-14 00:58 1499题记: 前几天讨论到WeakHashMap(这个是个弱引用的 ... -
《重构》读书笔记
2010-05-09 00:05 1045Martin Fowler于2003年出版 ... -
RPC之WebServices&RMI&JMS,phprpc框架?(待续)
2010-05-06 22:31 55前段时间写过基本的WebServices,也没再做深入 ...
相关推荐
“IBM面试及笔试经历——整理稿.doc”、“我的IBM——面经——整理稿.doc”和“IBM一面——11月21日D——整理稿.doc”等内容,可能详细描述了面试流程、面试官的提问、求职者的回答以及面试后的反思,这些都是宝贵的...
通过面试和笔试后,IBM会给出录用通知,并与应聘者讨论薪资和入职时间。此时,应聘者需要权衡接受offer的利弊,包括个人发展和公司的前景。 从这段经历中,我们可以总结出以下几点收获: 1. IBM提供的面试机会是一...
【IBM 笔试题 中文+英文】 IBM,全称国际商业机器公司,是全球领先的科技巨头,尤其在信息技术领域有着深远的影响力。IBM的笔试题是求职者在申请该公司职位时经常会遇到的一环,旨在评估候选人的技术能力、逻辑思维...
"笔试经验感想"部分则可能包含其他应聘者在IBM笔试过程中的体验和建议,比如他们是如何克服压力、如何在紧张的时间内完成复杂的题目、哪些部分是常见的难点等。这些来自实战的经验分享能帮助求职者更好地准备,避免...
对于2008年的IBM笔试题,虽然时间已过,但其题型和考察点依然具有参考价值。分析这些题目,可以洞察IBM历年笔试的风格和难度,为当前的应聘者提供宝贵的经验。同时,答案的存在可以帮助考生自我评估,找出自己的弱点...
在IBM的笔试中,考生可能会遇到各种类型的题目,这些题目旨在测试应聘者的逻辑思维、推理能力和快速运算能力。以下是对部分笔试题目的解析: 1. **香燃烧问题**: - 问题要求确定15分钟的时间。解决这个问题的方法...
- **考察重点**:IBM笔试主要侧重于评估应聘者的逻辑思维水平与推理能力。 - **语言要求**:笔试全程采用英文进行,对考生的英语阅读理解能力有较高要求。 - **必备词汇**:为了顺利通过笔试,应聘者需熟悉特定的...
比如“IBM2008笔试试题.doc”可能是2008年的笔试题目集合,而“IBM笔试.doc”可能是更通用或者综合性的笔试题目集。这些文档中的题目可能涵盖计算机科学的基础知识,例如数据结构、算法、操作系统、网络、数据库等,...
比如,错误代码的前几位可能代表了故障的类型,而后几位则可能指明了具体的组件或功能模块。 在IBM Storwize V系列存储系统中,常见的错误代码类型包括: - 1xx系列:这一系列错误代码通常指代硬件故障,比如控制...
IBM作为全球知名的科技公司,在招聘过程中往往会设置一系列的笔试题目来考察应聘者的逻辑思维能力、数学基础以及解决问题的能力。本篇内容将针对给定的IBM笔试题进行详细解析,帮助读者更好地理解和掌握相关知识点。...
总的来说,IBM的笔试题要求应聘者具备扎实的计算机基础知识,良好的逻辑思维能力和快速反应能力。准备这类考试时,除了复习相关的编程语言和技术概念,还需要提高对数学问题和逻辑题目的解题速度和准确度。同时,对...
IBM蓝色之路的笔试环节是对应聘者能力的一种全面评估,通常包含逻辑推理、数学计算和实际应用等多个方面的测试。以下是基于提供的部分内容对各个部分的解析: **第一部分:矩阵题** 这部分主要考察的是基础的数学...
这份"IBM笔试资料及面试"集合了IBM在招聘过程中可能涉及到的重要知识点和技术领域,旨在帮助求职者充分准备,提升成功通过的机会。 IBM笔试通常包含以下几个部分: 1. **逻辑推理**:IBM的笔试题目中会涉及逻辑...
【标题】"IBM的笔试资料"涉及的是IBM公司招聘过程中的笔试环节,这通常是对潜在候选人进行技术评估和能力测试的重要部分。IBM是全球知名的科技公司,其笔试环节旨在筛选出具备优秀技术能力和问题解决技能的应聘者。...
### IBM磁带机驱动器错误代码详解 #### 引言 IBM TotalStorage LTO Ultrium 2 Tape Drive,型号T400与T400F,是IBM为满足企业和数据中心对数据存储与备份需求而设计的高性能磁带机产品。在IT行业中,磁带机因其高...
【IBM2008招聘笔试题】是IBM公司在2008年进行的招聘过程中的一个环节,主要包括两大部分:IPAT(Information Processing Aptitude Test)和专业技术卷。IPAT测试主要考察应试者的逻辑推理和处理能力,而技术卷则针对...
### 2008 IBM 笔试与面试经验分享 #### 一、公司简介 **公司概况** IBM,即国际商业机器公司(International Business Machines Corporation),是一家成立于1911年的美国公司,总部位于纽约州阿蒙克市。起初,...
2008年的IBM笔试题作为经典案例,反映了公司在选拔人才时关注的关键技能和知识领域。以下是根据这些信息推测的一些可能的笔试知识点,以及相关的深入解析: 1. **计算机基础知识**:作为IT行业的巨头,IBM肯定会...
IBM公司作为全球知名的科技巨头,其程序员笔试题是求职者们了解公司技术要求、提升自身技能的重要途径。这些题目通常涵盖了计算机科学的基础知识、编程语言的掌握、算法设计与分析、软件工程实践等多个方面。下面将...
### IBM服务器面板指示灯报错代码对应表解析 #### 一、引言 IBM服务器作为高性能计算设备,在数据中心和企业级应用中发挥着至关重要的作用。为了确保服务器正常运行并及时发现潜在问题,IBM服务器设计了一系列指示...