====== Practics ====== ===== GUI ===== ==== Frame ==== Автономное приложение может создавать окно класса Frame, окно снабжается заголовком и может содержать меню. Для рисования в окне доступны все классы и методы библиотеки **AWT**, обычно применяемые апплетами\\ Для использования определяем новый класс наследуя от "Frame" и переопределяем конструктор, paint(), handlerEvent() и т.д.\\
:!: Пример package simFrame; import java.awt.*; public class SimpleFrame { public static void main(String args[]){ FrameWindow my_frame; my_frame = new FrameWindow("My Frame Window"); my_frame.show(); } } class FrameWindow extends Frame{ public FrameWindow(String szTitle){ super(szTitle); resize(200, 90); setBackground(Color.magenta); setForeground(Color.black); } public void paint(Graphics g){ g.setFont(new Font("Helvetica", Font.PLAIN, 12)); g.drawString("Text in frame", 10, 50); super.paint(g); } public boolean handleEvent(Event evt){ if(evt.id == Event.WINDOW_DESTROY){ setVisible(false); System.exit(0); return true; } else return super.handleEvent(evt); } }
===== Types ===== ==== Integer ==== **parseInt()** и **valueOf()** аналоги но первый возвращает **int а второй Integer**\\
:!: Пример
===== Build ===== ==== Manifest ====
:!: Manifest Manifest-Version: 1.0 Main-Class: com.gmware.applications.app.application.applicationMain Module-Name: app Module-Version: app.18.0.51079-34-gbefd25d8 Module-Commit-Date: 2023-02-22 06:14:30 +0000 Created-By: 17.0.5 Class-Path: profiles-app.18.0.51079.jar p_app-app.18.0.51079.jar pl c_evaluation-app.18.0.51079.jar pc_evaluation-app.18.0.51079.jar pr files-base-app.18.0.51079.jar
:!: Gradle скрипт plugins { id("application") id("maven-publish") id("com.github.johnrengelman.shadow") } group = "com.gmware.applications" version = "1.0.2-SNAPSHOT" dependencies { implementation(projects.utils) implementation(projects.tools) implementation(projects.common) implementation(projects.appcommon) implementation(projects.db) implementation(projects.gameinfo) implementation(projects.commonholdem) implementation(projects.metrics) implementation("uk.org.lidalia:sysout-over-slf4j:1.0.2") implementation(Deps.toml) } fun getGitCommit(): String { val result = StringBuilder() val process = ProcessBuilder("git", "rev-parse", "HEAD").start() process.inputStream.reader(Charsets.UTF_8).use { result.append(it.readText()) } process.waitFor() return result.toString().trim() } tasks { "shadowJar"(com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar::class) { from("${rootProject.rootDir}/resources/builds/logback/") { include("logback-logs-json.xml") rename("logback-logs-json.xml", "logback.xml") } application { this.mainClass.set("com.gmware.applications.externalservices.profilesacceleration.ProfileAcceleration") } this.isZip64 = true archiveClassifier.set("") archiveFileName.set("ProfileAcceleration.jar") manifest.attributes["Module-Version"] = getGitCommit() } } publishing { repositories { maven { url = uri("${properties["nexusUrl"]}/profile-snapshots") credentials { username = "${properties["nexusUser"]}" password = "${properties["nexusPassword"]}" } } } publications { register("mavenJava", MavenPublication::class) { artifact(tasks["shadowJar"]) } } }
==== ====
:!: Пример