2024-03-30
This commit is contained in:
57
doc/01_top_level_containers.md
Normal file
57
doc/01_top_level_containers.md
Normal file
@@ -0,0 +1,57 @@
|
||||
# 최상위 컨데이너
|
||||
JFrame, JDialog, JApplet 등이 최상위 컨테이너이며, 프로그램 창(윈도우)이라고도 이해할 수 있다.
|
||||
최상위 컨테이너는 시각적 컴포넌트를 위한 영역인 content pane을 가지고 있다.
|
||||
|
||||
## JFrame
|
||||
|
||||
* `getDefaultCloseOperation()` / `setDefaultCloseOperation(int)` : DO_NOTHING_ON_CLOSE | HIDE_ON_CLOSE | DISPOSE_ON_CLOSE | EXIT_ON_CLOSE
|
||||
* `getIconImage()` / `setIconImage(java.awt.Image)`
|
||||
* `getTitle()` / `setTitle(String)`
|
||||
* `isUndecorated()` / `setUndecorated(boolean)`
|
||||
* `isDefaultLookAndFeelDecorated()` / `setDefaultLookAndFeelDecorated(boolean)`
|
||||
|
||||
* `getSize()` / `setSize(int,int)` / `setSize(Dimension)`
|
||||
* `getBounds()` / `setBounds(int,int,int,int)` / `setBounds(Rectangle)` : x, y, width, height
|
||||
* `getLocation()` / `setLocation(int,int)` / `setLocationRelativeTo(Component)`
|
||||
* `pack()`
|
||||
|
||||
* `getContentPane()` / `setContentPnae(Container)`
|
||||
* `getRootPane()` / `setRootPane(JRootPane)` / `createRootPane()`
|
||||
* `getJMenuBar()` / `setJMenuBar(JMenuBar)`
|
||||
* `getGlassPane()` / `setGlassPane(Component)`
|
||||
* `getLayeredPane()` / `setLayeredPane(JLayeredPane)`
|
||||
|
||||
|
||||
```java
|
||||
public static void main(String... args) {
|
||||
// 컨텐트 패널에 버튼 등의 컴포넌트를 구성한다.
|
||||
final JPanel contentPane = new JPanel();
|
||||
contentPane.setBackground(Color.PINK);
|
||||
|
||||
// 프레임을 생성한다.
|
||||
final JFrame jFrame = new JFrame();
|
||||
jFrame.setTitle("Example");
|
||||
jFrame.setSize(800, 600);
|
||||
jFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
jFrame.setContentPane(contentPane);
|
||||
|
||||
// 이벤트 디스패치 스레드에서 프레임을 표시한다.
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
jFrame.setVisible(true);
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
## JDialog
|
||||
|
||||
|
||||
|
||||
## Full-screen Exclusive mode
|
||||
|
||||
```java
|
||||
if(graphicsDevice.isFullScreenSupported()){
|
||||
graphicsDevice.setFullScreenWindow(jFrame);
|
||||
// graphicsDevice.setFullScreenWindow(null); //null to exit
|
||||
}
|
||||
```
|
||||
### DisplayMode
|
||||
99
doc/02_basic_component_methods.md
Normal file
99
doc/02_basic_component_methods.md
Normal file
@@ -0,0 +1,99 @@
|
||||
# 컴포넌트 공통 사항
|
||||
|
||||
## 스타일
|
||||
* `getBorder()` / `setBorder(Border)`
|
||||
* `getForeground()` / `setForeground(Color)`
|
||||
* `getBackground()` / `setBackground(Color)`
|
||||
* `isOpaque()` / `setOpague(boolean)`
|
||||
* `getFont()` / `setFont(Font)`
|
||||
* `getCursor()` / `setCursor(Cursor)`
|
||||
|
||||
```java
|
||||
myComponent.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
|
||||
myComponent.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
myComponent.setBackground(Color.PINK);
|
||||
```
|
||||
|
||||
## 상태
|
||||
* `isEnabled()` / `setEnabled(boolean)`
|
||||
* `isVisible()` / `setVisible(boolean)`
|
||||
* `isShowing()`
|
||||
* `getName()` / `setName(String)` : 컴포넌트에 관리용 이름을 붙일 때 사용할 수 있다.
|
||||
* `setTooltipText()`
|
||||
* `getTransferHandler()` / `setTransferHandlerTransferHandler()` : 드래그&드롭에서 사용한다.
|
||||
* `setComponentPopupMenu(JPopupMenu)`
|
||||
|
||||
## 리스너
|
||||
* `addXXXListener()` / `removeXXXListener()`
|
||||
* HierarchyListener
|
||||
* MouseListener
|
||||
* MouseMotionListener
|
||||
* KeyListener
|
||||
* ComponentListener
|
||||
|
||||
## 컴포넌트
|
||||
* `add(Component)` / `add(Component,int)` / `add(Component,Object)`
|
||||
* `remove(int)` / `remove(Component)` / `removeAll()`
|
||||
* `contains(int,int)` / `contains(Point)` : 주어진 좌표가 컴포넌트 내부인가?
|
||||
* `getComponentAt(int,int)` / `getComponentAt(Point)`
|
||||
* `getComponentZOrder(Component)` / `setComponentZOrder(Component,int)`
|
||||
* `getComponentZOrder(int)` / `getComponentZOrder()`
|
||||
* `getRootPane()` / `getTopLevelAnscestor()` / `getParent()`
|
||||
* `getComponentCount()`
|
||||
* `getComponent(int)` / `getComponents()`
|
||||
|
||||
## 레이아웃
|
||||
* `getLayout()` / `setLayout(LayoutManager)`
|
||||
* `getPreferredSize()` / `setPreferredSize(Dimension)`
|
||||
* `getMaximumSize()` / `setMaximumSize(Dimension)`
|
||||
* `getMinimumSize()` / `setMinimumSize(Dimension)`
|
||||
* `getAlignmentX()` / `setAlignmentX(float)`
|
||||
* `getAlignmentY()` / `setAlignmentY(float)`
|
||||
* `applyComponentOrientation(ComponentOrientation)` / `setComponentOrientation(ComponentOrientation)`
|
||||
|
||||
## 위치와 크기
|
||||
* `getX()` / `getY()`
|
||||
* `getWidth()` / `getHeight()`
|
||||
* `getSize()` / `setSize(Dimension)`
|
||||
* `getBounds()` / `setBounds(Rectangle)`
|
||||
* `getLocation()` / `setLocation(Point)`
|
||||
* `getLocationOnScreen()`
|
||||
* `getInsets()` / `setInsets(Inset)`
|
||||
|
||||
## 패인팅
|
||||
* `repaint()` / `repaint(int,int,int,int)` / `repaint(Rectangle)`
|
||||
* `revalidate()`
|
||||
* `paintComponent(Graphics)` : 이 메서드를 오버라이드해서 커스텀 컴포넌트를 만든다.
|
||||
|
||||
|
||||
## Focus
|
||||
|
||||
* `isFocusOwner()`
|
||||
* `isRequestFocusEnabled()` / `setRequestFocusEnabled(boolean)`
|
||||
* `isFocusable()` / `setFocusable(boolean)`
|
||||
* `requestFocusInWindow()`
|
||||
* `getFocusTraversalKeys(int)` / `setFocusTraversalKeys(int,Set)` / `areFocusTraversalKeysSet(int)`
|
||||
|
||||
|
||||
### LayoutFocusTraversalPolicy
|
||||
|
||||
* `getComponentAfter(Container,Component)`
|
||||
* `getComponentBefore(Container,Component)`
|
||||
* `getFirstComponent(Container)` / `getInitialComponent(Container)` / `getLastComponent(Container)`
|
||||
|
||||
|
||||
* `container.getFocusTraversalPolicy()` / `container.setFocusTraversalPolicy(FocusTraversalPolicy)`
|
||||
* `container.isFocusCycleRoot()` / `container.setFocusCycleRoot(boolean)`
|
||||
* `container.isFocusTraversalPolicyProvider()` / `container.setFocusTraversalPolicyProvider(boolean)`
|
||||
|
||||
|
||||
## InputMap
|
||||
|
||||
* `component.getInputMap()` / `component.getInputMap(int)` : JComponent.WHEN_FOCUSED | WHEN_IN_FOCUSED_WINDOW | WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
|
||||
* `put(KeyStroke,Object)` : 키 스트록, 액션명. 키와 이름을 연결시킨다.
|
||||
* `KeyStroke.getKeyStroke(String)`
|
||||
|
||||
## ActionMap
|
||||
|
||||
* `component.getActionMap()`
|
||||
* `put(Object,Action)` : 이름과 액션을 연결시킨다.
|
||||
192
doc/03_text_components.md
Normal file
192
doc/03_text_components.md
Normal file
@@ -0,0 +1,192 @@
|
||||
# 텍스트 컴포넌트
|
||||
|
||||
* `isEditable()` / `setEditable(boolean)`
|
||||
* `getDragEnabled()` / `setDragEnabled(boolean)`
|
||||
* `getDisabledTextColor()` / `setDisabledTextColor(Color)`
|
||||
* `getMargin()` / `setMargin(Insets)` : 텍스트와 컴포넌트 보더 사이 간격
|
||||
|
||||
* `getSelectedText()`
|
||||
* `select(int,int)` / `selectAll()`
|
||||
* `getSelectionStart()` / `setSelectionStart(int)` / `getSelectionEnd()` / `setSelectionEnd(int)`
|
||||
* `getSelectionColor()` / `setSelectionColor(Color)`
|
||||
* `getSelectedTextColor()` / `setSelectedTextColor(Color)`
|
||||
|
||||
* `viewToModel(Point)` / `modelToView(int)`
|
||||
|
||||
* `copy()` / `cut()` / `paste()` / `replaceSelection(String)`
|
||||
* `getActions()`
|
||||
* `getInputMap()`
|
||||
* `put(KeyStroke,Object)`
|
||||
|
||||
* `getDocument()` / `setDocument(Document)`
|
||||
* `setDocumentFilter(DocumentFilter)`
|
||||
|
||||
* `getCaret()` / `setCaret(Caret)`
|
||||
* `getCaretColor()` / `setCaretColor(Color)`
|
||||
* `getCaretPosition()` / `moveCaretPosition(int)` / `setCaretPosition(int)`
|
||||
* `addCaretListener()` / `removeCaretListener()`
|
||||
|
||||
* `setNavigationFilter()`
|
||||
* `getHighlighter()` / `setHighlighter(Highlighter)`
|
||||
|
||||
* `read(Reader, Object)` / `write(Writer)`
|
||||
|
||||
* `print()` / `print(MessageFormat,MessageFormat)`
|
||||
* `getPrintable(MessageFormat,MessageFormat)`
|
||||
|
||||
## Document
|
||||
* `addDocumentListener()` / `removeDocumentListener()`
|
||||
* `addUndoableEditListener()` / `removeUndoableEditListener()`
|
||||
* `getLength()`
|
||||
* `getStartPosition()` / `getEndPosition()`
|
||||
* `getText(int,int)`
|
||||
* `getProperty(Object)` / `putProperty(Object,Object)` / `getDocumentProperties()` / `setDocumentProperties(Dictionary)`
|
||||
|
||||
## Undo / Redo 구현 - UndoableEditListener
|
||||
```java
|
||||
// 언두 매니저를 생성하고, 텍스트 문서에 리스너를 통해 연결한다.
|
||||
final UndoManager undoManager = new UndoManager();
|
||||
textArea.getDocument().addUndoableEditListener(undoableEditEvent ->
|
||||
undoManager.addEdit(undoableEditEvent.getEdit()));
|
||||
|
||||
// 버튼을 통해서 액션을 처리한다.
|
||||
toolBar.add(new AbstractAction("Undo") {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
if (undoManager.canUndo()) {
|
||||
undoManager.undo();
|
||||
}
|
||||
}
|
||||
});
|
||||
toolBar.add(new AbstractAction("Redo") {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
if (undoManager.canRedo()) {
|
||||
undoManager.redo();
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## DocumentListener
|
||||
```java
|
||||
textArea.getDocument().addDocumentListener(new DocumentListener() {
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent documentEvent) {
|
||||
Document document = documentEvent.getDocument();
|
||||
int changeLength = documentEvent.getLength();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeUpdate(DocumentEvent documentEvent) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changedUpdate(DocumentEvent documentEvent) {
|
||||
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## CaretListener
|
||||
```java
|
||||
textArea.addCaretListener(new CaretListener() {
|
||||
@Override
|
||||
public void caretUpdate(CaretEvent caretEvent) {
|
||||
int dot = caretEvent.getDot();
|
||||
int mark = caretEvent.getMark();
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## JTextField
|
||||
|
||||
* `getText()` / `setText(String)`
|
||||
* `isEditable()` / `setEditable(boolean)`
|
||||
* `getColumns()` / `setColumns(int)` : 화면에 표시될 칼럼 길이
|
||||
|
||||
* `selectAll()`
|
||||
|
||||
* `getHorizontalAlignment()` / `setHorizontalAlignment(int)` : JTextField.LEADING | CENTER | TRAILING
|
||||
|
||||
* `addActionListener()` / `removeActionListener()`
|
||||
|
||||
## JPasswordField
|
||||
|
||||
* `char[] getPassword()`
|
||||
* `getEchoChar()` / `setEchoChar(char)`
|
||||
|
||||
## JFormattedTextField
|
||||
|
||||
* `JFormattedTextField()` / `JFormattedTextField(Format)` / `JFormattedTextField(Formatter)` / `JFormattedTextField(FormatterFactory)`
|
||||
|
||||
* `getValue()` / `setValue(Object)`
|
||||
* `getFormatter()` / `setFormatterFactory()`
|
||||
* `setFocusLostBehavior(int)` : COMMIT_OR_REVERT | COMMIT | PERSIST | REVERT
|
||||
* `commitEdit()`
|
||||
* `isEditValid()`
|
||||
|
||||
### Format
|
||||
* DateFormatter
|
||||
* NumberFormatter
|
||||
* InternationalFormatter
|
||||
* MaskFormatter
|
||||
* DateFormat
|
||||
* SimpleDateFormat
|
||||
* NumberFormat
|
||||
* DefaultFormatterFactory
|
||||
* DefaultFormatter
|
||||
|
||||
#### DefaultFormatter
|
||||
|
||||
* `getCommitsOnValidEdit()` / `setCommitsOnValidEdit(boolean)`
|
||||
* `getOverwriteMode()` / `setOverwriteMode(boolean)`
|
||||
* `getAllowsInvalid()` / `setAllowsInvalid(boolean)`
|
||||
|
||||
#### MaskFormatter
|
||||
* `#` 아무 숫자 하나
|
||||
* `'` 이스케잎문자로 사용됨
|
||||
* `U` 대문자 하나
|
||||
* `L` 소문자 하나
|
||||
* `A` 문자 또는 숫자 하나
|
||||
* `?` 문자 하나
|
||||
* `*` 아무거나
|
||||
* `H` 16진수문자 하나
|
||||
|
||||
## JTextArea
|
||||
|
||||
* `JTextArea()` / `JTextArea(String)` / `JTextArea(int,int)` / `JTextArea(String,int,int)` : 칼럼 갯수, 열 갯수
|
||||
|
||||
* `getText()` / `setText(String)`
|
||||
|
||||
* `isEditable()` / `setEditable(boolean)`
|
||||
* `getColumns()` / `setColumns(int)`
|
||||
* `getRows()` / `setRows(int)`
|
||||
* `setTabSize(int)`
|
||||
* `setLineWrap(boolean)`
|
||||
* `setWrapStyleWord(boolean)`
|
||||
|
||||
* `selectAll()`
|
||||
|
||||
* `append(String)`
|
||||
* `insert(String,int)`
|
||||
* `replaceRange(String,int,int)`
|
||||
* `getLineCount()`
|
||||
* `getLineOfOffset(int)`
|
||||
* `getLineStartOffset(int)`
|
||||
* `getLineEndOffset(int)`
|
||||
|
||||
## JEditorPane
|
||||
|
||||
## JTextPane
|
||||
|
||||
58
doc/04_buttons.md
Normal file
58
doc/04_buttons.md
Normal file
@@ -0,0 +1,58 @@
|
||||
# 버튼
|
||||
|
||||
## AbstractButton
|
||||
* `getAction()` / `setAction(Action)`
|
||||
* `getText()` / `setText(String)`
|
||||
* `getIcon()` / `setIcon(Icon)`
|
||||
* `getDisabledIcon()` / `setDisabledIcon(Icon)`
|
||||
* `getPressedIcon()` / `setPressedIcon(Icon)`
|
||||
* `getSelectedIcon()` / `setSelectedIcon(Icon)`
|
||||
* `getDisabledSelectedIcon()` / `setDisabledSelectedIcon(Icon)`
|
||||
* `getRolloverIcon()` / `setRolloverIcon(Icon)`
|
||||
* `getRolloverSelectedIcon()` / `setRolloverSelectedIcon(Icon)`
|
||||
* `isRolloverEnabled()` / `setRolloverEnabled(boolean)`
|
||||
|
||||
* `getHorizontalAlignment()` / `setHorizontalAlignment(int)` : AbstractButton의 상수를 사용. CENTER | RIGHT | LEFT | LEADING | TRAILING
|
||||
* `getVerticalAlignment()` / `setVerticalAlignment(int)` : CENTER | TOP | BOTTOM
|
||||
* `getMargin()` / `setMargin(Insets)`
|
||||
* `isFocusPainted()` / `setFocusPainted(boolean)`
|
||||
* `isBorderPainted()` / `setBorderPainted(boolean)`
|
||||
* `getIconTextGap()` / `setIconTextGap(int)`
|
||||
|
||||
* `getMnemonic()` / `setMnemonic(int)` : KeyEvent의 상수를 사용
|
||||
* `getDisplayedMnemonicIndex()` / `setDisplayedMnemonicIndex(int)`
|
||||
* `getActionCommand()` / `setActionCommand(String)`
|
||||
* `addActionListener()` / `removeActionListener()`
|
||||
* `addItemListener()` / `removeItemListener()`
|
||||
* `isSelected()` / `setSelected(boolean)`
|
||||
* `doClick()` / `doClick(int)` : 버튼을 클릭한 시간을 밀리초 단위로 지정할 수도 있다.
|
||||
* `getMultiClickThreshhold()` / `setMultiClickThreshhold(long)` : 지정 시간 이내의 이벤트는 중복으로 무시한다.
|
||||
|
||||
## JButton
|
||||
|
||||
## JCheckBox
|
||||
|
||||
## JToggleButton
|
||||
|
||||
## 버튼 그룹 - ButtonGroup
|
||||
* `add(AbstractButton)` / `remove(AbstractButton)`
|
||||
* `clearSelection()`
|
||||
|
||||
```java
|
||||
// 버튼에 할당된 버튼 그룹을 가져오려는 경우
|
||||
ButtonGroup group = ((DefaultButtonModel)button.getModel()).getGroup();
|
||||
```
|
||||
|
||||
|
||||
## Action
|
||||
### AbstractAction
|
||||
|
||||
* `isEnabled()` / `setEnabled(boolean)`
|
||||
* `getValue(String)` / `putValue(String,Object)`
|
||||
* ACCELERATOR_KEY : KeyStroke
|
||||
* ACTION_COMMAND_KEY : String
|
||||
* LONG_DESCRIPTION
|
||||
* MNEMONIC_KEY
|
||||
* NAME
|
||||
* SHORT_DESCRIPTION
|
||||
* SMALL_ICON
|
||||
46
doc/05_file_cooser_color_chooser.md
Normal file
46
doc/05_file_cooser_color_chooser.md
Normal file
@@ -0,0 +1,46 @@
|
||||
# Color Chooser
|
||||
|
||||
|
||||
* `JColorChooser()` / `JColorChooser(Color)`
|
||||
|
||||
|
||||
* `showDialog()` / `createDialog()`
|
||||
* `getPreviewPanel()` / `setPreviewPanel()`
|
||||
* `getChooserPanels()` / `setChooserPanels(AbstractColorChooserPanel[])`
|
||||
* `addChooserPanel()` / `removeChooserPanel()`
|
||||
* `getDragEnabled()` / `setDragEnabled(boolean)`
|
||||
* `getColor()` / `setColor()`
|
||||
* `getSelectionModel()` / `setSelectionModel()`
|
||||
|
||||
|
||||
# File Chooser
|
||||
|
||||
|
||||
* `JFileChooser()` / `JFileChooser(File)` : 초기 경로를 지정할 수 있다.
|
||||
|
||||
|
||||
* `int showOpenDialog(Component)` : APPROVE_OPTION | CANCEL_OPTION | ERROR_OPTION
|
||||
* `int showSaveDialog(Component)`
|
||||
* `int showDialog(Component,Stirng)`
|
||||
|
||||
|
||||
* `getSelectedFile()` / `setSelectedFile(File)`
|
||||
* `getSelectedFiles()` / `setSelectedFiles(File[])`
|
||||
* `getFileSelectionMode()` / `setFileSelectionMode(int)` : FILES_ONLY | DIRECTORIES_ONLY | FILES_AND_DIRECTORIES
|
||||
* `isFileSelectionEnabled()` / `isDirectorySelectionEnabled()`
|
||||
* `isMultiSelectionEnabled()` / `setMultiSelectionEnabled()`
|
||||
* `isAcceptAllFileFilterUsed()` / `setAcceptAllFileFilterUsed(boolean)`
|
||||
* `Dialog createDialog(Component)`
|
||||
|
||||
|
||||
* `ensureFileIsVisible(File)`
|
||||
* `getCurrentDirectory()` / `setCurrentDirectory(File)`
|
||||
* `changeToParentDirectory()`
|
||||
* `rescanCurrentDirectory()`
|
||||
* `getDragEnabled()` / `setDragEnabled(boolean)`
|
||||
|
||||
|
||||
* `getAccessory()` / `setAccessory(JComponent)`
|
||||
* `getFileFilter()` / `setFileFilter(FileFilter)`
|
||||
* `getChoosableFileFilters()` / `resetChoosableFileFilters()`
|
||||
* `addChoosableFileFilter(FileFilter)` / `removeChoosableFileFilter(FileFilter)` / `getAcceptAllFileFilter()`
|
||||
23
doc/06_combo_box.md
Normal file
23
doc/06_combo_box.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# 콤보 박스
|
||||
|
||||
* `JComboBox()` / `JComboBox(Object[])` / `JComboBox(ComboBoxModel)`
|
||||
|
||||
|
||||
* `addItem(Object)` / `insertItemAt(Object,int)` : 항목을 동적으로 변경하려면, 콤보 박스의 데이터 모델이 MutableComboBoxModel이어야 한다.
|
||||
* `getSelectedItem()` / `getItemAt(int)`
|
||||
* `remoceItem(Object)` /`removeItemAt(int)` / `removeAllItems()` : 항목을 동적으로 변경하려면, 콤보 박스의 데이터 모델이 MutableComboBoxModel이어야 한다.
|
||||
* `getItemCount()`
|
||||
* `getModel()` / `setModel(ComboBoxModel)`
|
||||
* `getAction()` / `setActionAction)`
|
||||
|
||||
|
||||
* `addActionListener()`
|
||||
* `addItemListener()`
|
||||
|
||||
|
||||
* `isEditable()` / `setEditable(boolean)`
|
||||
|
||||
|
||||
* `getRenderer()` / `setRenderer(ListCellRenderer)` : 아이템 뷰를 커스터마이징 할 때 사용한다. 콤보 박스가 editable 일 때에는 editor가 대신 사용된다.
|
||||
* `getEditor()` / `setEditor(ComboBoxEditor)` : 콤보 박스가 editable 일 때 사용된다.
|
||||
|
||||
30
doc/07_dialog.md
Normal file
30
doc/07_dialog.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# 대화상자
|
||||
|
||||
|
||||
## JOptionPane
|
||||
* `void showMessageDialog()` : 부모 컴포넌트, 메시지, 타이틀, 메시지 타입, 아이콘
|
||||
* `int showOptionDialog()` : 부모 컴포넌트, 메시지, 타이틀, 옵션 타입, 메시지 타입, 아이콘, 옵션 목록, 초기값
|
||||
* `int showConfirmDialog()` : 부모 컴포넌트, 메시지, 타이틀, 옵션 타입, 메시지 타입, 아이콘
|
||||
* `String showInputDialog()` : 부모 컴포넌트, 메시지, 타이틀, 메시지 타입, 아이콘, 옵션 목록, 초기값
|
||||
* `showInternalMessageDialog()` / `showInternalXXXDialog()`
|
||||
|
||||
## JColorChooser
|
||||
|
||||
## JFileChooser
|
||||
|
||||
## JDialog
|
||||
|
||||
|
||||
* `getContentPane()` / `setContentPane(Container)`
|
||||
* `setLocationRelativeTo(Component)`
|
||||
* `getDefaultCloseOption()` / `setDefaultCloseOption(int)` : DISPOSE_ON_CLOSE | DO_NOTHING_ON_CLOSE | HIDE_ON_CLOSE
|
||||
* `isDefaultLookAndFeelDecorated()` / `setDefaultLookAndFeelDecorated(boolean)`
|
||||
|
||||
* `getModalityType()` / `setModalityType(Dialog.ModalityType)`
|
||||
|
||||
### ModalityType
|
||||
* Modeless type
|
||||
* Document-model type
|
||||
* Application-modal type
|
||||
* Toolkit-modal type
|
||||
* Exclusion mode
|
||||
55
doc/08_internal_frame.md
Normal file
55
doc/08_internal_frame.md
Normal file
@@ -0,0 +1,55 @@
|
||||
# Internal Frame
|
||||
|
||||
* `ststic int showInternalConfirmDialog()`
|
||||
* `static String showInternalInputDialog()`
|
||||
* `static Object showInternalMessageDialog()`
|
||||
* `static int showInternalOptionDialog()`
|
||||
|
||||
|
||||
* `getContentPane()` / `setContentPane(Container)`
|
||||
* `getJMenuBar()` / `setJMenuBar()`
|
||||
* `getLayeredPane()` / `setLayeredPane(JLayeredPane)`
|
||||
|
||||
* `setVisible(boolean)`
|
||||
* `pack()`
|
||||
* `setLocation(int,int)` / `setLocation(Point)`
|
||||
* `setBounds(int,int,int,int)` / `setBounds(Rectangle)`
|
||||
* `setSize(int,int)` / `setSize(Dimension)`
|
||||
|
||||
|
||||
* `getDefaultCloseOperation()` / `setDefaultCloseOperation(int)` : DISPOSE_ON_CLOSE | DO_NOTHING_ON_CLOSE | HIDE_ON_CLOSE
|
||||
* `addInternalFrameListener()` / `removeInternalFrameListener()`
|
||||
* `moveToFront()` / `moveToBack()`
|
||||
* `isClosed()` / `setClosed(boolean)`
|
||||
* `isIcon()` / `setIcon(boolean)`
|
||||
* `isMaximum()` / `setMaximum(boolean)`
|
||||
* `isSelected()` / `setSelected(boolean)`
|
||||
|
||||
* `getFrameIcon()` / `setFrameIcon(Icon)`
|
||||
* `isClosable()` / `setClosable(boolean)`
|
||||
* `isIconifiable()` / `setIconifiable(boolean)`
|
||||
* `isMaximizable()` / `setMaximizable(boolean)`
|
||||
* `isResizable()` / `setResizable(boolean)`
|
||||
* `getTitle()` / `setTitle(String)`
|
||||
|
||||
|
||||
## JDesktopPane
|
||||
|
||||
* `getAllFrames()`
|
||||
* `getAllFramesInLayer(int)`
|
||||
* `getDragMode()` / `setDragMode(int)` : LIVE_DRAG_MODE | OUTLINE_DRAG_MODE
|
||||
|
||||
|
||||
## JLayeredPane
|
||||
|
||||
* `jFrame.getLayeredPane()`
|
||||
|
||||
* `add(Component)` / `add(Component,Integer)` / `add(Component,Integer,int)` : 추가할 컴포넌트, 레이어, 레이어 내에서의 순서. 레이어가 지정되지 않으면 0번 레이어에 할당된다.
|
||||
* `setLayer(Component,int)` / `setLayer(Component,int,int)` : 컴포넌트의 위치를 변경.
|
||||
* `int getLayer(Component)`
|
||||
* `getComponentCountInLayer(int)`
|
||||
* `getComponentsInLayer(int)`
|
||||
* `int lowestLayer()` / `int highestLayer()`
|
||||
|
||||
* `getPosition(Component)` / `setPosition(Component,int)`
|
||||
* `moveToFront(Component)` / `moveToBack(Component)`
|
||||
18
doc/09_label.md
Normal file
18
doc/09_label.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# Label
|
||||
|
||||
* `getText()` / `setText(String)`
|
||||
* `getIcon()` / `setIcon(Icon)`
|
||||
* `getDisplayedMnemonic()` / `setDisplayedMnemonic(int)`
|
||||
* `getDisplayedMnemonicIndex()` / `setDisplayedMnemonicIndex(int)`
|
||||
* `getDisabledIcon()` / `setDisabledIcon(Icon)`
|
||||
|
||||
|
||||
* `getVerticalAlignment()` / `setVerticalAlignment(int)` : TOP | CENTER | BOTTOM
|
||||
* `getHorizontalAlignment()` / `setHorizontalAlignment(int)` : LEFT | CENTER | RIGHT | LEADING | TRAILING
|
||||
* `getVerticalTextPosition()` / `setVerticalTextPosition(int)` : TOP | CENTER | BOTTOM
|
||||
* `getHorizontalTextPosition()` / `setHorizontalTextPosition(int)` : LEFT | CENTER | RIGHT | LEADING | TRAILING
|
||||
* `getIconTextGap()` / `setIconTextGap(int)`
|
||||
|
||||
* `getLabelFor()` / `setLabelFor(Component)`
|
||||
|
||||
|
||||
23
doc/10_list.md
Normal file
23
doc/10_list.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# 리스트
|
||||
|
||||
* `getModel()` / `setModel(ListModel)`
|
||||
* `setListData(Object[])` / `setListData(Vector)` : 데이터를 수정할 수 없다.
|
||||
|
||||
|
||||
* `getLayoutOrientation()` / `setLayoutOrientation(int)` : VERTICAL | HORIZONTAL_WRAP | VERTICAL_WRAP
|
||||
* `getVisobleRowCount()` / `setVisibleRowCount(int)`
|
||||
* `getFirstVisibleIndex()` / `getLastVisibleIndex()`
|
||||
* `ensureIndexIsVisible(int)`
|
||||
|
||||
|
||||
* `getSelectionMode()` / `setSelectionMode(int)` : SINGLE_SELECTION | SINGLE_INTERVAL_SELECTION | MULTIPLE_INTERVAL_SELECTION
|
||||
* `addListSelectionListener(ListSelectionListener)`
|
||||
* `setSelectedIndex(int)` / `setSelectedIndices(int[])` / `setSelectedvalue(Object,int)` / `setSelectionInterval(int,int)`
|
||||
* `getSelectedIndex()` / `getSelectedIndices()` / `getSelectedValue()` / `getSelectedValues()`
|
||||
* `getMinSelectionIndex()` / `getMaxSelectionIndex()` / `getAnchorSelectionIndex()` / `getLeadSelectionIndex()`
|
||||
* `isSelectionEmpty()` / `clearSelection()`
|
||||
* `isSelectedIndex(int)`
|
||||
|
||||
* `setCellRenderer(ListCellRenderer)`
|
||||
|
||||
* `getDragEnabled()` / `setDragEnabled(boolean)`
|
||||
43
doc/11_menu.md
Normal file
43
doc/11_menu.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# 메뉴
|
||||
|
||||
## JMenuBar
|
||||
|
||||
* `add(JMenu)`
|
||||
* `jFrame.getJMenuBar()` / `jFrame.setJMenuBar(JMenuBar)`
|
||||
|
||||
|
||||
## JMenu
|
||||
|
||||
* `JMenu()` / `JMenu(String)` / `JMenu(Action)`
|
||||
|
||||
* `add(JMenuItem)` / `add(String)` / `addSeparator()`
|
||||
* `insert(JMenuItem,int)` / `insert(String,int)` / `insertSeparator(int)`
|
||||
* `remove(JMenuItem)` / `remove(int)` / `removeAll()`
|
||||
|
||||
## JPopupMenu
|
||||
|
||||
* `add(JMenuItem)` / `add(String)` / `addSeparator()`
|
||||
* `insert(JMenuItem,int)`
|
||||
* `remove(int)` / `removeAll()`
|
||||
* `setLightWeightPopupEnabled(boolean)`
|
||||
* `show(Component,int,int)`
|
||||
|
||||
## JMenuItem
|
||||
|
||||
* `setEnabled(boolean)`
|
||||
* `setMnemonic(int)` : KeyEvent.VK_...
|
||||
* `setAccelerator(KeyStroke)`
|
||||
* `setActionCommand(String)`
|
||||
* `addActionListener()`
|
||||
* `addItemListener()`
|
||||
* `setAction(Action)`
|
||||
|
||||
|
||||
## JCheckBoxMenuItem
|
||||
|
||||
* `getState()` / `setState(boolean)`
|
||||
|
||||
## JRadioButtonMenuItem
|
||||
|
||||
|
||||
|
||||
60
doc/12_panel.md
Normal file
60
doc/12_panel.md
Normal file
@@ -0,0 +1,60 @@
|
||||
# Panel
|
||||
|
||||
## JPanel
|
||||
|
||||
|
||||
* `add(Component)` / `add(Component,int)` / `add(Component,Object)` / `add(Component,Object,int)` / `add(String,Component)`
|
||||
* `getComponentCount()`
|
||||
* `getComponent(int)` / `getComponentAt(int,int)` / `getComponentAt(Point)` / `getComponents()`
|
||||
* `remove(Component)` / `remove(int)` / `removeAll()`
|
||||
|
||||
* `getLayout()` / `setLayout(LayoutManager)`
|
||||
|
||||
|
||||
|
||||
|
||||
## JRootPane
|
||||
* Glass pane
|
||||
* Layered pane
|
||||
* FRAME_CONTENT_LAYER : -30000
|
||||
* DEFAULT_LAYER : 0
|
||||
* PALETTE_LAYER : 100
|
||||
* MODAL_LAYER : 200
|
||||
* POPUP_LAYER : 300
|
||||
* DRAG_LAYER : 400
|
||||
* Content pane
|
||||
* JMenu bar
|
||||
|
||||
|
||||
* `jFrame.getRootPane()`
|
||||
* `SwingUtilities.getRootPane(Component)`
|
||||
* `jComponent.getRootPane()`
|
||||
|
||||
* `getDefaultButton()` / `setDefaultButton(JButton)`
|
||||
|
||||
* `jFrame.getGlassPane()` / `jFrame.setGlassPane(Component)`
|
||||
* `jFrame.getLayeredPane()` / `jFrame.setLayeredPane(Component)`
|
||||
* `jFrame.getContentPane()` / `jFrame.setContentPane(Container)`
|
||||
* `jFrame.getJMenuBar()` / `jFrame.setJMenuBar(JMenuBar)`
|
||||
|
||||
|
||||
## JScrollPane
|
||||
|
||||
* `JScrollPane(Component)` / `JScrollPane(Component,int,int)`
|
||||
|
||||
|
||||
* `setviewportView(Component)`
|
||||
* `getVerticalScrollBarPolicy()` / `setVerticalScrollBarPolicy(int)` : ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED | VERTICAL_SCROLLBAR_ALWAYS | VERTICAL_SCROLLBAR_NEVER
|
||||
* `getHorizontalScrollBarPolicy()` / `setHorizontalScrollBarPolicy(int)` : ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED | HORIZONTAL_SCROLLBAR_ALWAYS | HORIZONTAL_SCROLLBAR_NEVER
|
||||
* `getViewportBorder()` / `setViewportBorder(Border)`
|
||||
* `isWheelScrollingEnabled()`
|
||||
|
||||
* `setRowHeaderView(Component)` / `setColumnHeaderView(Component)`
|
||||
* `getCornet(String)` / `setCorner(String,Component)` : ScrollPaneConstants.UPPER_LEFT_CORNER | UPPER_RIGHT_CORNER | LOWER_LEFT_CORNER | LOWER_RIGHT_CORNER | LOWER_LEADING_CORNER | LOWER_TRAILING_CORNER | UPPER_LEADING_CORNER | UPPER_TRAILING_CORNER
|
||||
|
||||
### Scrollable
|
||||
|
||||
* `getScrollableUnitIncrement()` / `getScrollableBlockIncrement()`
|
||||
* `getPreferredScrollableViewportSize()`
|
||||
* `getScrollableTracksViewportWidth()` / `getScrollableTracksViewportHeight()`
|
||||
|
||||
39
doc/13_progress_bar.md
Normal file
39
doc/13_progress_bar.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# 프로그래스 바
|
||||
|
||||
## JProgressBar
|
||||
|
||||
* `JProgressBar()` / `JProgressBar(int)` / `JProgressBar(int,int)` / `JProgressBar(int,int,int)` : HORIZONTAL | VERTICAL, 최소값, 최대값
|
||||
|
||||
* `getValue()` / `setValue(int)`
|
||||
* `double getPercentComplete()`
|
||||
* `getMinimum()` / `setMinimum(int)`
|
||||
* `getMaximum()` / `setMaximum(int)`
|
||||
* `getModel()` / `setModel(BoundedRangeModel)`
|
||||
|
||||
|
||||
* `getIndeterminated(boolean)`
|
||||
* `getOrientation()` / `setOrientation(int)` : HORIZONTAL | VERTICAL
|
||||
* `isBorderPainted()` / `setBorderPainted(boolean)`
|
||||
* `isStringPainted()` / `setStringPainted(boolean)`
|
||||
* `getString()` / `setString(String)`
|
||||
|
||||
|
||||
## ProgressMonitor
|
||||
|
||||
진행률을 대화상자로 표시합니다. 특이하게도, 'J'로 시작하지 않네요.
|
||||
|
||||
* `ProgressMonitor(Component,Object,String,int,int)` : 부모 컴포넌트, 메시지, 노트, 최소값, 최대값
|
||||
|
||||
* `getMinimum()` / `setMinimum(int)`
|
||||
* `getMaximum()` / `setMaximum(int)`
|
||||
* `setProgress(int)`
|
||||
* `getNote()` / `setNote(String)`
|
||||
* `getMillisToDecideToPopup()` / `setMillisToDecideToPopup(int)`
|
||||
|
||||
* `close()`
|
||||
* `isCanceled()`
|
||||
|
||||
## ProgressMonitorInputStream
|
||||
|
||||
* `getProgressMonitor()`
|
||||
|
||||
16
doc/14_separator.md
Normal file
16
doc/14_separator.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# Separator
|
||||
|
||||
* `jToolbar.addSeparator()` / `jToolbar.addSeparator(Dimension)`
|
||||
* `jMenu.addSeparator()` / `jMenu.insertSeparator(int)`
|
||||
* `jPopupMenu.addSeparator()`
|
||||
|
||||
|
||||
* `JSeparator()` / `JSeparator(int)` : SwingConstants.HORIZONTAL | VERTICAL
|
||||
* `getOrientation()` / `setOrientation(int)`
|
||||
|
||||
|
||||
* `JToolBar.Separator()` | `JToolBar.Separator(Dimension)`
|
||||
* `setSeparatorSize(Dimension()`
|
||||
|
||||
|
||||
* `JPopupMenu.Separator()`
|
||||
20
doc/15_slider.md
Normal file
20
doc/15_slider.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# Slider
|
||||
|
||||
* `JSlider(int,int,int,int)` : 방향, 최소값, 최대값, 초기값
|
||||
|
||||
* `getValue()` / `setValue(int)`
|
||||
* `getOrientation()` / `setOrientation(int)` : JSlider.HORIZONTAL | VERTICAL
|
||||
* `getInverted()` / `setInverted(boolean)`
|
||||
* `getMinimum()` / `setMinimum(int)` / `getMaximum()` / `setMaximum(int)`
|
||||
* `getModel()` / `setModel(BoundedRangeModel)` : DefaultBoundedRangeModel implements BoundedRangeModel
|
||||
* `getMajorTickSpacing()` / `setMajorTickSpacing(int)`
|
||||
* `getMinorTickSpacing()` / `setMinorTickSpacing(int)`
|
||||
* `getPaintTicks()` / `setPaintTicks(boolean)`
|
||||
* `getPaintLabels()` / `setPaintLabels()`
|
||||
* `getLabelTable()` / `setLabelTable(Dictionary)`
|
||||
* `Hashtable createStandardLabels(int)` / `Hashtable createStandardLabels(int,int)`
|
||||
* `setFont(Font)`
|
||||
|
||||
* `addChangeListener()`
|
||||
* `boolean getValueIsAdjusting()`
|
||||
|
||||
42
doc/16_spinner.md
Normal file
42
doc/16_spinner.md
Normal file
@@ -0,0 +1,42 @@
|
||||
# Spinner
|
||||
|
||||
* `JSpinner()` / `JSpinner(SpinnerModel)`
|
||||
|
||||
* `getValue()` / `setValue(Object)`
|
||||
* `getPreviousValue()` / `getNextValue()`
|
||||
* `getModel()` / `setModel(SpinnerModel)`
|
||||
* `getEditor()` / `setEditor(JComponent)`
|
||||
* `protected JComponent createEditor(SpinnerModel)`
|
||||
|
||||
## SpinnerModel
|
||||
|
||||
### SpinnerListModel
|
||||
|
||||
* `getList()` / `setList(List)`
|
||||
|
||||
### SpinnerNumberModel
|
||||
|
||||
* `Number getNumber()` / `setValue(Object)`
|
||||
* `getMinimum()` / `setMinimum(Comparable)`
|
||||
* `getMaximum()` / `setMaximum(Comparable)`
|
||||
* `getStepSize()` / `setStepSize(Number)`
|
||||
|
||||
### SpinnerDateModel
|
||||
|
||||
* `getDate()` / `getValue()` / `setValue(Object)`
|
||||
* `getStart()` / `setStart(Comparable)`
|
||||
* `getEnd()` / `setEnd(Comparable)`
|
||||
* `getCalendarField()` / `setCalendarField(int)` : Calendar.ERA | YEAR | MONTH | WEEK_OF_YEAR | WEEK_OF_MONTH | DAY_OF_MONTH | DAY_OF_YEAR | DAY_OF_WEEK | DAY_OF_WEEK_IN_MONTH | AM_PM | HOUR_OF_DAY | MINUTE | SECOND | MILLISECOND
|
||||
|
||||
## JSpinner.DefaultEditor
|
||||
|
||||
* `JFormattedTextField getTextField()`
|
||||
|
||||
### JSpinner.ListEditor
|
||||
### JSpinner.DateEditor
|
||||
|
||||
* `JSpinner.DateEditor(JSpinner,String)` : 포맷
|
||||
|
||||
### JSpinner.NumberEditor
|
||||
|
||||
* `JSpinner.NumberEditor(JSpinner,String)` : 포맷
|
||||
16
doc/17_split_pane.md
Normal file
16
doc/17_split_pane.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# Split Pane
|
||||
|
||||
* `getOrientation()` / `setOrientation(int)` : HORIZONTAL_SPLIT | VERTICAL_SPLIT
|
||||
* `getDividerSize()` / `setDividerSize(int)`
|
||||
* `isContinuousLayout()` / `setContinuousLayout(boolean)` : 설정되면, 디바이더가 움직일때마다 화면을 다시 그린다.
|
||||
* `isOneTouchExpandable()` / `setOneTouchExpandable(boolean)`
|
||||
|
||||
* `getLeftComponent()` / `getTopComponent()` / `setLeftComponent(component)` / `setTopComponent(Component)`
|
||||
* `getRightComponent()` / `getBottomComponent()` / `setRightComponent(component)` / `setBottomComponent(Component)`
|
||||
* `remove(Component)` / `removeAll()`
|
||||
|
||||
* `getDividerLocation()` / `setDividerLocation(int)` / `setDividerLocation(double)`
|
||||
* `resetToPreferredSizes()`
|
||||
* `getLastDividerLocation()` / `setLastDividerLocation(int)`
|
||||
* `getMinimumDividerLocation()` / `getMaximumDividerLocation()`
|
||||
* `getResizeWeight()` / `setResizeWeight(float)` : 0.0 ~ 1.0
|
||||
29
doc/18_tabbed_pane.md
Normal file
29
doc/18_tabbed_pane.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# Tabbed pane
|
||||
|
||||
* `JTabbedPane()` / `JTabbedPane(int)` / `JTabbedPane(int,int)` : TOP | BOTTOM | LEFT | RIGHT, WRAP_TAB_LAYOUT | SCROLL_TAB_LAYOUT
|
||||
|
||||
* `addTab(String,Icon,Component,String)` / `addTab(String,Icon,Component)` / `addTab(String,Component)` : 타이틀, 아이콘, 패널, 툴팁
|
||||
* `insertTab(String,Icon,Component,String,int)`
|
||||
* `removeTab(Component)` / `removeTabAt(int)` / `removeAll()`
|
||||
* `getTabLayoutPolicy()` / `setTabLayoutPolicy(int)` : WRAP_TAB_LAYOUT | SCROLL_TAB_LAYOUT
|
||||
* `getTabPlacement()` / `setTabPlacement(int)` : TOP | BOTTOM | LEFT | RIGHT
|
||||
|
||||
* `indexOfComponent(Component)` / `indexOfTab(String)` / `indexOfTab(Icon)`
|
||||
* `getSelectedIndex()` / `setSelectedIndex(int)` / `getSelectedComponent()` / `setSelectedComponent(Component)`
|
||||
|
||||
|
||||
* `getComponentAt()` / `setComponentAt(int,Component)`
|
||||
* `getTitleAt(int)` / `setTitleAt(int,String)`
|
||||
* `getIconAt(int)` / `setIconAt(int,Icon)`
|
||||
* `getDisabledIconAt(int)` / `setDisabledIconAt(int,Icon)`
|
||||
* `getBackgroundAt(int)` / `setBackgroundAt(int,Color)`
|
||||
* `getForegroundAt(int)` / `setForegroundAt(int,Icon)`
|
||||
* `isEnabledAt(int)` / `setEnabledAt(int,boolean)`
|
||||
* `getMnemonicAt(int)` / `setMnemonicAt(int,int)`
|
||||
* `getDisplayedMnemonicIndexAt(int)` / `setDisplayedMnemonicIndexAt(int,int)`
|
||||
* `getToolTipTextAt(int)` / `setToolTipTextAt(int,String)`
|
||||
|
||||
* `getTabComponentAt(int)` / `setTabComponentAt(int,Component)`
|
||||
* `indexOfTabComponent(Component)`
|
||||
|
||||
|
||||
65
doc/19_table.md
Normal file
65
doc/19_table.md
Normal file
@@ -0,0 +1,65 @@
|
||||
# 테이블
|
||||
|
||||
## JTable
|
||||
|
||||
* `JTable(Object[][],Object[])` / `JTable(TableModel)`
|
||||
|
||||
|
||||
* `setFillsViewportHeight(boolean)`
|
||||
* `getTableModel()`
|
||||
* `getTableHeader()`
|
||||
* `getColumnModel()`
|
||||
* `setAutoResizeMode(int)`
|
||||
* `setSelectionMode(int)` : ListSelectionModel.MULTIPLE_INTERVAL_SELECTION | SINGLE_INTERVAL_SELECTION | SINGLE_SELECTION
|
||||
* `getRowSelectionAllowed()` / `setRowSelectionAllowed(boolean)`
|
||||
* `getColumnSelectionAllowed()` / `setColumnSelectionAllowed(boolean)`
|
||||
* `getCellSelectionAllowed()` / `setCellSelectionAllowed(boolean)`
|
||||
* `getSelectedRows()` / `getSelectedColumns()`
|
||||
|
||||
* `setDefaultRenderer()`
|
||||
* `setDefaultEditor()`
|
||||
|
||||
* `setAutoCreateRowSorted(boolean)`
|
||||
* `setRowSorted(TableRowSorter)`
|
||||
|
||||
|
||||
## TableModel
|
||||
|
||||
* `addTableModelListener()`
|
||||
* `fireTableCellUpdated()`
|
||||
* `fireTableRowUpdated()`
|
||||
* `fireTableDataChanged()`
|
||||
* `fireTableRowsInserted()`
|
||||
* `fireTableRowsDeleted()`
|
||||
* `fireTableStructureChanged()`
|
||||
|
||||
### DefaultTableModel
|
||||
|
||||
### AbstractTableModel
|
||||
|
||||
## JTableHeader
|
||||
|
||||
## TableColumnModel
|
||||
|
||||
* `getColumn()`
|
||||
|
||||
## TableColumn
|
||||
|
||||
* `setPreferredWidth(int)`
|
||||
* `setCellRenderer()`
|
||||
* `setCellEditor()`
|
||||
|
||||
|
||||
## TableModelListener
|
||||
|
||||
## TableCellRenderer
|
||||
|
||||
* `setToolTipText()`
|
||||
|
||||
### DefaultTableCellRenderer
|
||||
|
||||
## TableRowSorter
|
||||
|
||||
## TableCellEditor
|
||||
### DefaultCellEditor
|
||||
### AbstractCellEditor
|
||||
10
doc/20_toolbar.md
Normal file
10
doc/20_toolbar.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# ToolBar
|
||||
|
||||
* `JToolBar()` / `JToolBar(int)` / `JToolBar(String)` / `JToolBar(String,int)` : 타이틀, 방향. HORIZONTAL | VERTICAL
|
||||
|
||||
* `add(Component)`
|
||||
* `addSeparator()`
|
||||
|
||||
* `isFloatable()` / `setFloatable(boolean)`
|
||||
* `isRollover()` / `setRollover(boolean)`
|
||||
|
||||
5
doc/21_tooltip.md
Normal file
5
doc/21_tooltip.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Tool tip
|
||||
|
||||
* `jComponent.getToolTipText()` / `jComponent.setToolTipText(String)`
|
||||
* `jComponent.getToolTipText(MouseEvent)`
|
||||
* `jComponent.getToolTipLocation(MouseEvent)`
|
||||
54
doc/22_tree.md
Normal file
54
doc/22_tree.md
Normal file
@@ -0,0 +1,54 @@
|
||||
# Tree
|
||||
|
||||
|
||||
## JTree
|
||||
|
||||
* `setCellRenderer(TreeCellRenderer)`
|
||||
* `setCellEditor(TreeCellEditor)`
|
||||
* `setEditable(boolean)`
|
||||
* `setRootVisible(boolean)`
|
||||
* `setShowsRootHandles(boolean)`
|
||||
* `getDragEnabled()` / `setDragEnabled(boolean)`
|
||||
|
||||
* `addTreeSelectionListener()`
|
||||
* `getSelectionModel()` / `setSelectionModel()` : TreeSelectionModel.CONTIGUOUS_TREE_SELECTION | DISCONTIGUOUS_TREE_SELECTION | SINGLE_TREE_SELECTION
|
||||
* `getLastSelectedPathComponent()`
|
||||
* `getSelectionPath()` / `setSelectionPath(TreePath)` / `getSelectionPaths()` / `setSelectionPaths(TreePath[])`
|
||||
|
||||
* `addTreeExpansionListener()`
|
||||
* `addTreeWillExpandListener()`
|
||||
* `expandPath(TreePath)`
|
||||
* `collapsePath(TreePath)`
|
||||
* `scrollPathToVisible(TreePath)`
|
||||
* `makeVisible(TreePath)`
|
||||
* `getScrollsOnExpand()` / `setScrollsOnExpand(boolean)`
|
||||
* `getToggleClickCount()` / `setToggleClickCount(int)` : 기본값은 더블 클릭.
|
||||
* `TreePath getNextMatch(String,int,Position.Bias)`
|
||||
|
||||
|
||||
|
||||
## TreePath
|
||||
|
||||
## TreeNode
|
||||
### MutableTreeNode
|
||||
### DefaultMutableTreeNode
|
||||
|
||||
## TreeModel
|
||||
### DefaultTreeModel
|
||||
|
||||
## TreeCellRenderer
|
||||
### DefaultTreeCellRenderer
|
||||
|
||||
## TreeCellEditor
|
||||
### DefaultTreeCellEditor
|
||||
|
||||
## TreeSelectionListener
|
||||
### TreeSelectionEvent
|
||||
|
||||
## TreeModelListener
|
||||
### TreeModelEvent
|
||||
|
||||
## TreeExpansionListener
|
||||
### TreeExpansionEvent
|
||||
|
||||
## TreeWillExpandListener
|
||||
10
doc/23_icon.md
Normal file
10
doc/23_icon.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# Icon
|
||||
|
||||
* `getImage()` / `setImage(Image)`
|
||||
* `paintIcon(Component,Graphics,int,int)`
|
||||
* `getDescription()` / `setDescription(String)`
|
||||
* `getIconWidth()` / `getIconHeight()`
|
||||
|
||||
* `getImageObserver()` / `setImageObserver(ImageObserver)`
|
||||
* `getImageLoadStatus()`
|
||||
|
||||
13
doc/24_border.md
Normal file
13
doc/24_border.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Border
|
||||
|
||||
* `BorderFactory.createLineBorder()`
|
||||
* `BorderFactory.createEtchedBorder()`
|
||||
* `BorderFactory.createLoweredBevelBorder()` / `BorderFactory.createRaisedBevelBorder()` / `BorderFactory.createBevelBorder()`
|
||||
* `BorderFactory.createEmptyBorder()`
|
||||
* `BorderFactory.createMatteBorder()`
|
||||
* `BorderFactory.createTitledBorder()`
|
||||
* `BorderFactory.createCompoundBorder()`
|
||||
|
||||
|
||||
* `component.getBorder()` / `component.setBorder(Border)`
|
||||
* `component.isBorderPainted()` / `component.setBorderPainted(boolean)`
|
||||
45
doc/25_thread.md
Normal file
45
doc/25_thread.md
Normal file
@@ -0,0 +1,45 @@
|
||||
# Thread
|
||||
|
||||
```java
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
jFrame.setVisible(true);
|
||||
});
|
||||
```
|
||||
|
||||
* `SwingUtilities.isEventDispatchThread()`
|
||||
|
||||
|
||||
## Swing Worker
|
||||
|
||||
SwingWorker의 첫 번째 제너릭은 `doInBackground()`의 반환 타입입니다.
|
||||
두 번째 제너릭은 `publish()`와 `process()`가 서로 주고 받는 데이터 타입입니다.
|
||||
|
||||
* **doInBackground()** : 백그라운드에서 작업을 처리합니다.
|
||||
* **done()** : 백그라운드 작업이 끝난 직후에 이벤트 디스패치 스레드에서 실행됩니다.
|
||||
* **publish()** : 백그라운드 작업 도중, 중간 결과를 내보냅니다. 이벤트 디스패치 스레드에서 **process()**가 호출됩니다.
|
||||
|
||||
|
||||
* `get()` / `get(long,TimeUnit)`
|
||||
* `setProgress()`
|
||||
* `SwingWorker.StateValue getState()`
|
||||
* `isCancelled()` / `isDone()`
|
||||
|
||||
|
||||
## Swing Timer
|
||||
|
||||
타이머는 지연 시간 이후에 이벤트 디스패치 스레드에서 액션을 실행합니다.
|
||||
|
||||
```java
|
||||
final Timer timer = new Timer(0, new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
|
||||
}
|
||||
});
|
||||
timer.start();
|
||||
```
|
||||
|
||||
* `getDelay()` / `setDelay(long)`
|
||||
* `getInitialDelay()` / `setInitialDelay(long)`
|
||||
* `isRepeats()` / `setRepeats(boolean)`
|
||||
* `start()` / `restart()` / `stop()`
|
||||
76
doc/26_desktop.md
Normal file
76
doc/26_desktop.md
Normal file
@@ -0,0 +1,76 @@
|
||||
# Desktop
|
||||
|
||||
* `Desktop.isDesktopSupported()`
|
||||
* `Desktop.getDesktop()`
|
||||
* `isSupported(Desktop.Action)`
|
||||
* `browse(URI)`
|
||||
* `mail(URI)`
|
||||
* `open(File)`
|
||||
* `edit(File)`
|
||||
* `print(File)`
|
||||
|
||||
## Desktop.Action
|
||||
* BROWSE
|
||||
* MAIL
|
||||
* OPEN
|
||||
* EDIT
|
||||
* PRINT
|
||||
|
||||
# GraphicsEnvironment
|
||||
|
||||
* `GraphicsEnvironment.getLocalGraphicsEnvironment()`
|
||||
* `GraphicsDevice getDefaultScreenDevice()`
|
||||
|
||||
# GraphicsDevice
|
||||
|
||||
* `isWindowTranslucencySupported()` : WindowTranslucency.TRANSLUCENT | PERPIXEL_TRANSLUCENT | PERPIXEL_TRANSPARENT
|
||||
|
||||
```java
|
||||
jFrame.setOpacity(0.5f);
|
||||
```
|
||||
|
||||
|
||||
## Splash Screen
|
||||
|
||||
* `SplashScreen.getSplashScreen()`
|
||||
* `Graphics2D createGraphics()`
|
||||
* `getBounds()`
|
||||
* `close()`
|
||||
|
||||
|
||||
```java
|
||||
final SplashScreen splashScreen = SplashScreen.getSplashScreen();
|
||||
Graphics2D graphics2D = splashScreen.createGraphics();
|
||||
// ...
|
||||
splashScreen.close();
|
||||
```
|
||||
|
||||
```
|
||||
Manifest-Version: 1.0
|
||||
Main-Class: <class name>
|
||||
SplashScreen-Image: <image name>
|
||||
|
||||
```
|
||||
|
||||
|
||||
## System tray
|
||||
|
||||
* `SystemTray.isSupported()`
|
||||
* `SystemTray.getSystemTray()`
|
||||
* `add(TrayIcon)` / `remove(TrayIcon)`
|
||||
|
||||
|
||||
```java
|
||||
if(SystemTray.isSupported()){
|
||||
SystemTray systemTray = SystemTray.getSystemTray();
|
||||
systemTray.add(new TrayIcon(...));
|
||||
}
|
||||
```
|
||||
### TrayIcon
|
||||
|
||||
* `TrayIcon(Image,String,PopupMenu)`
|
||||
|
||||
* `setImage(Image)`
|
||||
* `setImageAutoSize(boolean)`
|
||||
* `setPopupMenu(PopupMenu)`
|
||||
* `setToolTip(String)`
|
||||
99
doc/27_layout_manager.md
Normal file
99
doc/27_layout_manager.md
Normal file
@@ -0,0 +1,99 @@
|
||||
# Layout Manager
|
||||
|
||||
* `component.setMinimumSize()` / `component.setMaximumSize()` / `component.setPreferredSize()`
|
||||
|
||||
## Border Layout
|
||||
|
||||
* PAGE_START
|
||||
* PAGE_END
|
||||
* LINE_START
|
||||
* LINE_END
|
||||
* CENTER
|
||||
|
||||
* `container.add(Component,BorderLayout.CENTER)`
|
||||
* `setHGap(int)` / `setVGap(int)`
|
||||
|
||||
## Box Layout
|
||||
|
||||
* LINE_AXIS
|
||||
* PAGE_AXIS
|
||||
|
||||
### Box.Filler
|
||||
|
||||
* `Box.createRigidArea()` : 컴포넌트 사이에 고정된 크기의 공간을 만들 때 사용합니다.
|
||||
* `Box.createHorizontalGlue()` / `Box.createVerticalGlue()` : 컴포넌트 사이에 최대한의 빈 공간을 만들고자 할 때 사용합니다.
|
||||
* `Box.createHorizontalStrut()` / `Box.createVerticalStrut()` : Strut보다는 RigidArea를 사용
|
||||
* `new Box.Filler(Dimension,Dimension,Dimension)` : 최소, 희망, 최대 크기.
|
||||
|
||||
* `changeShape(Dimension,Dimension,Dimension)` : 레이아웃도 따라서 변경된다.
|
||||
|
||||
## Card Layout
|
||||
|
||||
* `container.add(Component,String)`
|
||||
|
||||
* `first(Container)` / `last(Container)`
|
||||
* `next(Container)` / `previous(Container)`
|
||||
* `show(Container,String)`
|
||||
|
||||
## Flow Layout
|
||||
|
||||
JPanel의 기본 레이아웃 매니저입니다.
|
||||
|
||||
* LEADING
|
||||
* CENTER
|
||||
* TRAILING
|
||||
|
||||
* `setHGap(int)` / `setVGap(int)`
|
||||
* `setAlignment(int)` : FlowLayout.LEADING | CENTER | TRAILING
|
||||
|
||||
## Grid Bag Layout
|
||||
|
||||
* `add(Component,GridBagConstraints)`
|
||||
|
||||
### GridBagConstraints
|
||||
* gridx, gridy : 컴포넌트가 위치할 열과 행의 좌표를 지정한다. RELATIVE를 지정하면 이전 컴포넌트의 오른쪽이나 아래에 놓는다.
|
||||
* gridwidth, gridheight : 컴포넌트가 몇 칸을 차지할지를 지정한다. 기본 값은 1이다. 열이나 행의 마지막 컴퍼넌트에는 REMAINDER를 사용한다.
|
||||
* fill : 컴포넌트 보다 큰 공간을 어떻게 채울지를 지정한다. NONE | HORIZONTAL | VERTICAL | BOTH
|
||||
* ipadx, ipady : 컴포넌트 안쪽의 패딩 크기를 지정한다.
|
||||
* insets : 컴포넌트 외부의 패딩 크기를 지정한다.
|
||||
* anchor : CENTER | PAGE_START | PAGE_END | LINE_START | LINE_END | FIRST_LINE_START | FIRST_LINE_END | LAST_LINE_END | LAST_LINE_START
|
||||
* weightx, weighty : 컴포넌트가 어느 정도의 크기를 가질지 가중치를 지정한다. 0 ~ 1사이의 값을 지정하며, 기본값은 0이다.
|
||||
|
||||
|
||||
## Grid Layout
|
||||
|
||||
* `GridLayout(int,int)` : 열과 행의 크기를 지정한다.
|
||||
|
||||
## Group Layout
|
||||
|
||||
* Horizontal group / Vertical group
|
||||
* Sequential group / Parallel group
|
||||
|
||||
* `addPreferredGap()` / `addContainerGap()` : RELATED | UNRELATED | INDENT
|
||||
* `setAutoCreateGaps(boolean)` / `setAutoCreateContainerGaps(boolean)`
|
||||
|
||||
## Spring Layout
|
||||
|
||||
* NORTH
|
||||
* SOUTH
|
||||
* EAST
|
||||
* WEST
|
||||
* BASELINE
|
||||
* HORIZONTAL_CENTER
|
||||
* VERTICAL_CENTER
|
||||
|
||||
|
||||
* `getConstraints(Component)`
|
||||
* `Spring getConstraint(String,Component)`
|
||||
* `putConstraint(String,Component,int,String,Component)` / `putConstraint(String,Component,Spring,String,Component)`
|
||||
|
||||
### SpringLayout.Constraints
|
||||
|
||||
* `getX()` / `getY()` / `getWidth()` / `getHeight()` / `setX()` / `setY()` / `setWidth()` / `setHeight()`
|
||||
* `getConstraint(String)` / `setConstraint(String,Spring)`
|
||||
|
||||
### Spring
|
||||
|
||||
* `constant(int)` / `constant(int,int,int)`
|
||||
* `Spring.sum(Spring,Spring)` / `Spring.max(Spring,Spring)` / `Spring.minus(Spring,Spring)`
|
||||
* `getValue()` / `setValue(int)`
|
||||
20
doc/28_look_and_feel.md
Normal file
20
doc/28_look_and_feel.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# Look and Feel
|
||||
|
||||
```java
|
||||
try {
|
||||
//UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
|
||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
||||
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException |
|
||||
UnsupportedLookAndFeelException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
```java
|
||||
// 프로그램 실행 후 룩앤필을 변경하는 경우
|
||||
UIManager.setLookAndFeel(lnfName);
|
||||
SwingUtilities.updateComponentTreeUI(frame);
|
||||
frame.pack();
|
||||
|
||||
```
|
||||
61
doc/29_drag_and_drop.md
Normal file
61
doc/29_drag_and_drop.md
Normal file
@@ -0,0 +1,61 @@
|
||||
# Drag & Drop
|
||||
|
||||
## TransferHandler
|
||||
|
||||
* `component.setDragEnabled(boolean)`
|
||||
* `component.setDropMode(DropMode)`
|
||||
* `component.setTransferHandler(TransferHandler)`
|
||||
|
||||
|
||||
### 보내기
|
||||
|
||||
* `getSourceActions(JComponent)` : 보내는 컴포넌트가 어떤 액션을 지원하는지.
|
||||
* `createTransferable(JComponent)` : 데이터를 묶어서 Transferable 객체로 만든다.
|
||||
* `exportDone(JComponent,Transferable,int)` : 내보내기가 완료된 이후에 호출된다.
|
||||
|
||||
### 받기
|
||||
|
||||
* `canImport(Transferable.TransferSupport)` : 드래깅 동작 중 반복적으로 호출되며, 받는 컴퍼넌트가 드롭 동작을 지원하면 true를 반환한다.
|
||||
* `importData(Transferable.TransferSupport)` : 드롭 동작 후에 호출되며, 데이터 전송이 성공한 경우에는 true를 반환한다.
|
||||
|
||||
|
||||
## TransferSupport
|
||||
|
||||
* `getComponent()`
|
||||
* `getDropAction()` : COPY | MOVE | LINK | COPY_OR_MOVE | NONE
|
||||
* `getUserDropAction()`
|
||||
* `getSourceDropActions()`
|
||||
* `getDataFlavors()`
|
||||
* `isDataFlavorSupported(DataFlavor)`
|
||||
* `getTransferable()`
|
||||
* `getDropLocation()`
|
||||
|
||||
* `setShowDropLocation(boolean)`
|
||||
|
||||
## DataFlavor
|
||||
|
||||
* allHtmlFlavor
|
||||
* fragmentHtmlFlavor
|
||||
* imageFlavor
|
||||
* javFileListFlavor
|
||||
* javaJVMLocaleObjectMimeType
|
||||
* javaRemoteObjectMimeType
|
||||
* javaSerializedObjectMimeType
|
||||
* selectionHtmlFlavor
|
||||
* stringFlavor
|
||||
|
||||
## DropLocation
|
||||
* JList.DropLocation
|
||||
* `isInsert()`
|
||||
* `getIndex()`
|
||||
* JTree.DropLocation
|
||||
* `getChildIndex()`
|
||||
* `getPath()`
|
||||
* JTable.DropLocation
|
||||
* `isInsertRow()`
|
||||
* `isInserColumn()`
|
||||
* `getRow()`
|
||||
* `getColumn()`
|
||||
* JTextComponent.DropLocation
|
||||
* `getIndex()`
|
||||
* `getBias()`
|
||||
47
doc/30_listener.md
Normal file
47
doc/30_listener.md
Normal file
@@ -0,0 +1,47 @@
|
||||
# Listeners
|
||||
|
||||
## ActionListener
|
||||
|
||||
## CaretListener
|
||||
|
||||
## ChangeListener
|
||||
|
||||
## ComponentListener
|
||||
|
||||
## ContainerListener
|
||||
|
||||
## DocumentListener
|
||||
|
||||
## FocusListener
|
||||
|
||||
## ItemListener
|
||||
|
||||
## KeyListener
|
||||
|
||||
## ListDataListener
|
||||
|
||||
## ListSelectionListener
|
||||
|
||||
## MouseListener
|
||||
|
||||
## MouseMotionListener
|
||||
|
||||
## MouseWheelListener
|
||||
|
||||
## PropertyChangeListener
|
||||
|
||||
## TableModelListener
|
||||
|
||||
## TreeExpansionListener
|
||||
|
||||
## TreeModelListener
|
||||
|
||||
## TreeSelectionListener
|
||||
|
||||
## TreeWillExpandListener
|
||||
|
||||
## UndoableEditListener
|
||||
|
||||
## WindowListener
|
||||
|
||||
## WindowStateListener
|
||||
66
doc/31_painting.md
Normal file
66
doc/31_painting.md
Normal file
@@ -0,0 +1,66 @@
|
||||
# Painting
|
||||
|
||||
```java
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
final Graphics2D graphics2D = (Graphics2D) g;
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
* `component.paint(Graphics)`
|
||||
* `paintComponent(Graphics)` -> `paintBorder(Graphics)` -> `paintChildren(Graphics)`
|
||||
|
||||
|
||||
## Graphics2D
|
||||
|
||||
|
||||
* `drawString()`
|
||||
* `drawImage()`
|
||||
* `drawLine()`
|
||||
* `drawArc()` / `drawRect()` / `drawOval()` / `drawPolygon()`
|
||||
* `draw()`
|
||||
* `fillArc()` / `fillRect()` / `fillOval()` / `fillPolygon()`
|
||||
* `fill()`
|
||||
|
||||
* `rotate()`
|
||||
* `scale()`
|
||||
* `shear()`
|
||||
* `translate()`
|
||||
|
||||
### Stroke
|
||||
|
||||
```java
|
||||
import java.awt.*;
|
||||
|
||||
Graphics2D graphics2D = (Graphics2D) g;
|
||||
BasicStroke stroke = new BasicStroke(1.f,BasicStroke.CAP_BUTT,BasicStroke.JOIN_MITER,10.f,{10.f},0.f);
|
||||
graphics2D.setStroke(stroke);
|
||||
```
|
||||
#### Join style
|
||||
* JOIN_BEVEL
|
||||
* JOIN_MITER
|
||||
* JOIN_ROUND
|
||||
|
||||
#### End-cap style
|
||||
* CAP_BUTT
|
||||
* CAP_ROUND
|
||||
* CAP_SQUARE
|
||||
|
||||
### Paint
|
||||
* `Color`, `GradientPaint`, `TexturePaint`
|
||||
|
||||
```java
|
||||
import java.awt.*;
|
||||
|
||||
Paint paint = new GradientPaint(x1,y1,color1,x2,y2,color2);
|
||||
graphics2D.setPaint(paint);
|
||||
```
|
||||
|
||||
|
||||
### AffineTransform
|
||||
|
||||
* `AffineTransform.getRotateTransform()`
|
||||
* `AffineTransform.getScaleTransform()`
|
||||
* `AffineTransform.getShearTransform()`
|
||||
* `AffineTransform.getTranslateTransform()`
|
||||
75
doc/32_geometric.md
Normal file
75
doc/32_geometric.md
Normal file
@@ -0,0 +1,75 @@
|
||||
# 도형
|
||||
|
||||
## Point
|
||||
|
||||
* Point2D.Double
|
||||
* Point2D.Float
|
||||
|
||||
```java
|
||||
import java.awt.geom.Point2D;
|
||||
|
||||
Point2D point = new Point2D.Double(x, y);
|
||||
```
|
||||
|
||||
## Line
|
||||
|
||||
* Line2D.Double
|
||||
* Line2D.Float
|
||||
|
||||
```java
|
||||
import java.awt.geom.Line2D;
|
||||
|
||||
Line2D line = new Line2D.Double(point1, point2);
|
||||
```
|
||||
|
||||
## Curve
|
||||
|
||||
```java
|
||||
import java.awt.geom.CubicCurve2D;
|
||||
import java.awt.geom.QuadCurve2D;
|
||||
|
||||
QuadCurve2D quadCurve = new QuadCurve2D.Double(x1, y1, ctrlx, ctrly, x2, y2);
|
||||
|
||||
CubicCurve2D cubicCurve = new CubicCurve2D.Double(x1, y1, ctrlx1, ctrly1, ctrlx2,ctrly2,x2, y2);
|
||||
```
|
||||
|
||||
## Rectangle
|
||||
|
||||
```java
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.awt.geom.RoundRectangle2D;
|
||||
|
||||
Rectangle2D rectangle = new Rectangle2D.Double(x, y, width, height);
|
||||
|
||||
RoundRectangle2D roundRectangle = new RoundRectangle2D.Double(x,y,width,height,archw,archy);
|
||||
```
|
||||
|
||||
## Ellipse
|
||||
|
||||
```java
|
||||
import java.awt.geom.Ellipse2D;
|
||||
|
||||
Ellipse2D ellipse = new Ellipse2D.Double(x,y,width,height);
|
||||
```
|
||||
|
||||
## Arc
|
||||
|
||||
```java
|
||||
import java.awt.geom.Arc2D;
|
||||
|
||||
Arc2D arc = new Arc2D.Double(x,y,width,height,start,extent,type);
|
||||
```
|
||||
|
||||
## GeneralPath
|
||||
|
||||
* `moveTo(x,y)`
|
||||
* `lineTo(x,y)`
|
||||
* `quadTo(ctrlx,ctrly,x2,y2)`
|
||||
* `curveTo(ctrlx1,ctrly1,ctrlx2,ctrly2,x2,y2)`
|
||||
* `closePath()`
|
||||
|
||||
```java
|
||||
import java.awt.geom.GeneralPath;
|
||||
|
||||
GeneralPath path = new GeneralPath();
|
||||
```
|
||||
31
doc/33_font.md
Normal file
31
doc/33_font.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# Font
|
||||
|
||||
```java
|
||||
Font font = Font.createFont(Font.TRUETYPE_FONT, new File("Abc.ttf"));
|
||||
return font.deriveFont(12.f);
|
||||
```
|
||||
|
||||
* `getFamily()`
|
||||
* `getFontName()`
|
||||
* `getAttributes()`
|
||||
|
||||
* `graphics2D.getFont()` / `graphics2D.setFont(Font)`
|
||||
* `Font.createFont(int,InputStream)`
|
||||
|
||||
* `deriveFont()`
|
||||
|
||||
* `graphicsEnvironment.getAvailableFontFamilyNames()`
|
||||
* `graphicsEnvironment.getAllFonts()`
|
||||
|
||||
```java
|
||||
HashMap<TextAttribute,Object> map = new HashMap<>();
|
||||
map.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
|
||||
font = font.deriveFont(map);
|
||||
```
|
||||
|
||||
## FontMetrics
|
||||
```java
|
||||
FontMetrics fontMetrics = graphics2D.getFontMetrics(font);
|
||||
int textHeight = fontMetrics.getHeight();
|
||||
int textWidth = fontMetrics.stringWidth("Hello");
|
||||
```
|
||||
1
doc/35_editor_pane.md
Normal file
1
doc/35_editor_pane.md
Normal file
@@ -0,0 +1 @@
|
||||
https://docs.oracle.com/javase/tutorial/uiswing/components/editorpane.html
|
||||
Reference in New Issue
Block a user