Обновить подгруженный класс - Java
Формулировка задачи:
Доброго времени суток, возможно ли в java обновить подгруженный класс ?
я подгрузил класс, изменил в нем переменную и как его обновить или подгрузить так что бы он перекрыл сам себя а не накладывался на себя новым слоем.
Листинг программы
- class_numText class_numtext = new class_numText();
- class_numtext.n = _num;
- add(class_numtext.new numText());
Решение задачи: «Обновить подгруженный класс»
textual
Листинг программы
- public class Oz {
- public JFrame window;
- public Dorothy dorothy = new Dorothy();
- public Oz() {
- window = new JFrame("Welcom");
- window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- window.setBounds(0, 0, 450, 360);
- window.setLayout(null);
- window.add(dorothy);
- window.setVisible(true);
- window.addMouseListener(new mouseClick());
- }
- public class mouseClick implements MouseListener {
- public void mouseClicked(MouseEvent e) {
- // dorothy.word ="ffdhkslajlkjdfla";
- dorothy.speak.setText("Other text");
- }
- public void mouseEntered(MouseEvent e) {
- }
- public void mouseExited(MouseEvent e) {
- }
- public void mousePressed(MouseEvent e) {
- }
- public void mouseReleased(MouseEvent e) {
- }
- }
- public static void main(String[] args) {
- new Oz();
- }
- }
- class Dorothy extends JComponent {
- public JTextField speak;
- public String word = "Helloy World";
- public Dorothy() {
- setSize(450, 360);
- magicText();
- }
- public void magicText() {
- speak = new JTextField(word, 50);
- speak.setBounds(0, 0, 180, 30);
- speak.setOpaque(false);
- speak.setBorder(null);
- speak.setEditable(false);
- speak.setHighlighter(null);
- speak.setForeground(Color.WHITE);
- Font font = new Font("Arial", Font.ITALIC + Font.BOLD, 25);
- speak.setFont(font);
- add(speak);
- }
- }
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д