本文介绍eclipse如何添加get set方法
材料/工具
eclipse
方法
1、在代码的空白处右击-->"Generate Getters and Setters.... "
2、点击之后,会出现下图所示的窗体,选择要添加get set方法的属性,在右侧点击“Select Getters” 和"Select Setters" 分别添加get set方法。最后点击OK就可以了
以下是Java中Eclipse中的所有set方法:1. setActionCommand(String command)
2. setAlignmentX(float alignmentX)
3. setAlignmentY(float alignmentY)
4. setAlwaysOnTop(boolean alwaysOnTop)
5. setBackground(Color bg)
6. setBackgroundAt(int index, Color background)
7. setBounds(int x, int y, int width, int height)
8. setBorder(Border border)
9. setBorderPainted(boolean b)
10. setBounds(Rectangle r)
11. setCancelButtonText(String cancelText)
12. setClickable(boolean clickable)
13. setColumns(int columns)
14. setContentPane(Container contentPane)
15. setCurrentDirectory(File dir)
16. setCursor(Cursor cursor)
17. setDebugGraphicsOptions(int debugOptions)
18. setDefaultButton(JButton defaultButton)
19. setDefaultCloseOperation(int operation)
20. setDefaultLightWeightPopupEnabled(boolean enabled)
21. setDialogTitle(String title)
22. setDirectoryOnly(boolean directoryOnly)
23. setDisabledIcon(Icon disabledIcon)
24. setDisabledSelectedIcon(Icon disabledSelectedIcon)
25. setDividerLocation(int location)
26. setDocument(Document doc)
27. setDoubleBuffered(boolean aFlag)
28. setDragEnabled(boolean b)
29. setEnabled(boolean enabled)
30. setExtendedState(int state)
31. setFileFilter(FileFilter filter)
32. setFocusable(boolean focusable)
33. setFocusCycleRoot(boolean focusCycleRoot)
34. setFocusOwner(Component focusOwner)
35. setFont(Font font)
36. setForeground(Color fg)
37. setForegroundAt(int index, Color foreground)
38. setIcon(Icon icon)
39. setIconAt(int index, Icon icon)
40. setIgnoreRepaint(boolean ignoreRepaint)
41. setIndex(int index)
42. setInputVerifier(InputVerifier inputVerifier)
43. setInsets(Insets insets)
44. setLabelFor(Component labelFor)
45. setLayout(LayoutManager layout)
46. setLightWeightPopupEnabled(boolean aFlag)
47. setLocale(Locale locale)
48. setLookAndFeel(String className)
49. setMaximumSize(Dimension maximumSize)
50. setMinimumSize(Dimension minimumSize)
51. setModel(BoundedRangeModel newModel)
52. setMnemonic(int mnemonic)
53. setModal(boolean modal)
54. setName(String name)
55. setOpaque(boolean isOpaque)
56. setPreferredSize(Dimension preferredSize)
57. setPrompt(String prompt)
58. setProperty(String propertyName, Object value)
59. setResizable(boolean resizable)
60. setSelected(boolean selected)
61. setSelectedIndex(int index)
62. setSelectedTextColor(Color color)
63. setSelectedValue(Object anObject, boolean shouldScroll)
64. setSelectionColor(Color selectionColor)
65. setSelectionEnd(int selectionEnd)
66. setSelectionModel(ListSelectionModel newModel)
67. setSelectionStart(int selectionStart)
68. setSplitterPosition(int position)
69. setStartOffset(int offset)
70. setState(Frame.State state)
71. setStepSize(double d)
72. setSubElements(ArrayList<Element>subElements)
73. setTabLayoutPolicy(int policy)
74. setPreferredSize(Dimension preferredSize)
75. setToolTipText(String text)
76. setTransferHandler(TransferHandler newHandler)
77. setUI(ComponentUI newUI)
78. setValue(Object aValue, boolean isSelected)
79. setVisible(boolean b)
80. setViewportView(Component view)
81. setWantsInput(boolean wantsInput)
82. setWrapStyleWord(boolean wrap)
83. setXORMode(boolean state)
84. setYear(int year)
85. setZoom(int zoom)
86. setZOrder(Component comp, int index)
希望可以帮到您的工作。
自动生成get,set方法:步骤一:在声明的类中,单击鼠标右键,选择source
步骤二:选择Generate Getters and Setters
步骤三:根据需要配置,如位置,顺序等,在选择确定即可
自动生成构造方法:
步骤一:在声明的类中,单击鼠标右键,选择source
步骤二:选择Generate Constructor using Fields
步骤三:在Generate Constructor using Fields对话框中, 将类的全部属性或部分属性钩上,点OK即可
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)