This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. СРЕДА РАЗРАБОТКИ ПРИЛОЖЕНИЙ NETBEANS | |
РАБОЧАЯ ПАПКА ПРОЕКТОВ ПО-УМОЛЧАНИЮ: | |
C:\Documents and Settings\<ИМЯ_ПОЛЬЗОВАТЕЛЯ>\Мои документы\NetBeansProjects | |
ЗАПУСК ПРОГРАММЫ НА ВЫПОЛНЕНИЕ: Заходим в меню "Выполнить" - "Запустить проект" (F6) | |
СОХРАНЕНИЕ ПРОЕКТА: Заходим в меню "Файл" - "Сохранить все" (Ctrl+Shift+S) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. ПРИМЕРЫ ПРОСТЕЙШИХ ПРОГРАММ С ГРАФИЧЕСКИМ ИНТЕРФЕЙСОМ | |
1.1. Пример деления двух цифр | |
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { | |
// Вычисление выражения | |
String a, b, c; // Строковые переменные | |
double z; // Вещественные переменные | |
double x, y; // Вещественные переменные |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. СЛУЧАЙНЫЕ ЧИСЛА В JTable | |
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { | |
// Случайные числа в JTable | |
long k; | |
for (int i = 0; i < jTable1.getRowCount(); i++) { | |
for (int j = 0; j < jTable1.getColumnCount(); j++) { | |
k = Math.round(Math.random() * 10); | |
jTable1.setValueAt(String.valueOf(k), i, j); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. ТИПЫ ДАННЫХ | |
1.1. Целые типы | |
byte: -128 .. 127 | |
short: -32768 .. 32767 | |
int: -2147483648 .. 2147483647 | |
long: -922372036854775808 .. 922372036854775807 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. ОДНОМЕРНЫЕ СТАТИЧЕСКИЕ МАССИВЫ | |
package tsn01.array; | |
import java.util.Arrays; | |
public class TSN01_Array { | |
public static void main(String[] args) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. ОКНО «JFrame» | |
1.1. Установка внешнего вида окна в стиле «Windows» | |
Для установки внешнего вида окна в стиле «Windows», необходимо зайти в программный код окна (вкладка «Источник»), раскрыть весь программный код (нажав на значки «+»), и найти следующий фрагмент кода: | |
if ("Nimbus".equals(info.getName())) { | |
javax.swing.UIManager.setLookAndFeel(info.getClassName()); | |
break; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. ПРИМЕРЫ РАБОТЫ СО СТРОКАМИ | |
1.1. Преобразования строк | |
package tsn01.string; | |
public class TSN01_String { | |
public static void main(String[] args) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. МЕТКА «JLabel» | |
В свойстве text можно не только задавать простейший текст, но и задавать его в виде html-текста, например: | |
<html> | |
<h1>Большой текст</h1> | |
<h2>Небольшой текст</h2> | |
<h3>Поменьше текст</h3> | |
<b>Жирная надпись</b><br> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. РАБОТА С ТАЙМЕРАМИ | |
1.1. Пример работы с swing-таймерами | |
public class Form1 extends javax.swing.JFrame { | |
… | |
// Текст таймера прописывается в данном месте кода формы вручную! | |
// Таймер будет вызываться каждую миллисекунду |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. МНОГООКОННЫЕ ПРОГРАММЫ | |
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { | |
// Переход на 2 окно, кнопка «Вперед» | |
this.setVisible(false); // Спрятать главное окно 1 | |
jFrame2.setVisible(true); // Показать окно 2 | |
} | |
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { |
OlderNewer