Перейти из форума на сайт.

НовостиФайловые архивы
ПоискАктивные темыТоп лист
ПравилаКто в on-line?
Вход Забыли пароль? Первый раз на этом сайте? Регистрация
Компьютерный форум Ru.Board » Компьютеры » Прикладное программирование » Задачка на Java

Модерирует : ShIvADeSt

 Версия для печати • ПодписатьсяДобавить в закладки
На первую страницук этому сообщениюк последнему сообщению

Открыть новую тему     Написать ответ в эту тему

vs6262



Silver Member
Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору

/*
https://cratecode.com/info/java-swing-library
http://www.java2s.com/Tutorials/Java/Scripting_in_Java/0040__Scripting_in_Java_eval.htm
 
https://stackoverflow.com/questions/61122943/transparent-unclickable-and-unfocusable-window-in-java
 
 
 
*/
 
import javax.swing.*;
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.metal.DefaultMetalTheme;
import javax.swing.plaf.metal.MetalLookAndFeel;
import java.awt.*;
import java.util.function.*;
 
public class Core {
 
 
 
    public static void main(String [] args) {
        new Core();
    }
 
    public Point location;
    public int x_Core = 0;
    public int y_Core = 0;
 
 
    public Core() {
        JFrame frame = new JFrame();
        JLabel label = new JLabel("Click in Frame 2 to transfer text!");
        frame.add(label);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setLocation(300, 300);
        frame.setSize(300, 300);
        // frame.setLocationRelativeTo(null);
 
 
 
 
        frame.setUndecorated(true);
        frame.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
 
        JPanel panel = new JPanel();
        panel.setBackground(Color.DARK_GRAY);
 
 
 
 
 
 
 
 
 
 
 
 
 
        frame.setContentPane(panel);
 
        MetalLookAndFeel.setCurrentTheme(new MyDefaultMetalTheme_000001());
        try {
            UIManager.setLookAndFeel(new MetalLookAndFeel());
        } catch (Exception e) {
            e.printStackTrace();
        }
 
        SwingUtilities.updateComponentTreeUI(frame);
 
 
 
        frame.setAlwaysOnTop(true);
        frame.setFocusableWindowState(false);
        frame.setResizable(false);
 
 
 
        frame.setVisible(true);
 
        location = frame.getLocationOnScreen();
        x_Core = location.x;
        y_Core = location.y;
 
 
        Consumer<String> consumer = s -> label.setText(s);
        new Window_Login(consumer);
    }
}
 
class Window_Login{
    private int clicks;
    public Window_Login(Consumer<String> consumer) {
        JFrame frame = new JFrame();
        // frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       // frame.setLocation(x_Core+40, y_Core+40);
        frame.setSize(350, 250);
        frame.setLocationRelativeTo(null);
        // frame.getLocation();
 
 
        frame.setUndecorated(true);
        frame.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
 
        JPanel panel = new JPanel();
        panel.setBackground(Color.DARK_GRAY);
 
 
 
 
 
 
 
 
 
 
 
 
        //5-zeiliges und 20-spaltiges Textfeld wird erzeugt
        JTextArea textfeld = new JTextArea(5, 20);
 
        //Text f&#252;r das Textfeld wird gesetzt
        textfeld.setText("Lorem ipsum dolor sit amet, " +
                "consetetur sadipscing elitr, sed diam nonumy " +
                "eirmod tempor invidunt ut labore et " +
                "dolore magna aliquyam erat, sed diam voluptua. " +
                "At vero eos et accusam et justo duo dolores et " +
                "ea rebum.");
        //Zeilenumbruch wird eingeschaltet
        textfeld.setLineWrap(true);
 
        //Zeilenumbr&#252;che erfolgen nur nach ganzen W&#246;rtern
        textfeld.setWrapStyleWord(true);
 
        //Ein JScrollPane, der das Textfeld beinhaltet, wird erzeugt
        JScrollPane scrollpane = new JScrollPane(textfeld);
 
        //Scrollpane wird unserem Panel hinzugef&#252;gt
        panel.add(scrollpane);
        frame.add(panel);
 
        textfeld.append(", Peter");
 
        frame.setContentPane(panel);
 
        MetalLookAndFeel.setCurrentTheme(new MyDefaultMetalTheme_000001());
        try {
            UIManager.setLookAndFeel(new MetalLookAndFeel());
        } catch (Exception e) {
            e.printStackTrace();
        }
 
        SwingUtilities.updateComponentTreeUI(frame);
 
 
        frame.setAlwaysOnTop(true);
        frame.setResizable(false);
 
 
 
 
        frame.setVisible(true);
    }
}
 
 
 
class MyDefaultMetalTheme_000001 extends DefaultMetalTheme {
    public ColorUIResource getWindowTitleInactiveBackground() {
        return new ColorUIResource(java.awt.Color.BLACK);
    }
 
    public ColorUIResource getWindowTitleBackground() {
        return new ColorUIResource(java.awt.Color.BLACK);
    }
 
    public ColorUIResource getPrimaryControlHighlight() {
        return new ColorUIResource(java.awt.Color.BLACK);
    }
 
    public ColorUIResource getPrimaryControlDarkShadow() {
        return new ColorUIResource(java.awt.Color.BLACK);
    }
 
    public ColorUIResource getPrimaryControl() {
        return new ColorUIResource(java.awt.Color.BLACK);
    }
 
    public ColorUIResource getControlHighlight() {
        return new ColorUIResource(java.awt.Color.BLACK);
    }
 
    public ColorUIResource getControlDarkShadow() {
        return new ColorUIResource(java.awt.Color.BLACK);
    }
 
    public ColorUIResource getControl() {
        return new ColorUIResource(java.awt.Color.BLACK);
    }
}

Всего записей: 2188 | Зарегистр. 25-02-2013 | Отправлено: 03:09 27-01-2024
Открыть новую тему     Написать ответ в эту тему

На первую страницук этому сообщениюк последнему сообщению

Компьютерный форум Ru.Board » Компьютеры » Прикладное программирование » Задачка на Java


Реклама на форуме Ru.Board.

Powered by Ikonboard "v2.1.7b" © 2000 Ikonboard.com
Modified by Ru.B0ard
© Ru.B0ard 2000-2024

BitCoin: 1NGG1chHtUvrtEqjeerQCKDMUi6S6CG4iC

Рейтинг.ru