GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - VenityStudio/java-reflection-ext: Java Bridge for jPHP

This repository was archived by the owner on Jun 7, 2019. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

15 Commits
15 Commits

Folders and files

NameName
Last commit message
Last commit date
api-docs
api-docs
 
 
sdk/java/reflection
sdk/java/reflection
 
 
src-bundle
src-bundle
 
 
src-jvm/main
src-jvm/main
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
package.php.yml
package.php.yml
 
 

Repository files navigation

Java Bridge for jPHP

Venity project status Build Status

How to build ?

Use jppm publish --yes command to build and publish to local repository

API Documentation

  • Русский
  • English

Example

Building Swing form:

use java\reflection\ReflectionClass;
use java\reflection\ReflectionTypes; // import classes

$frame_class = ReflectionClass::forName("javax.swing.JFrame"); // get ReflectionClass for javax.swing.JFrame
$frame = $frame_class->getConstructor([ ReflectionClass::forName("java.lang.String") ])->newInstance([ "Test!" ]); // get new java class instance from construcor
// getting setDefaultCloseOperation method & invoke it
$frame_class->getMethod("setDefaultCloseOperation", [ ReflectionTypes::typeInt() ])->invoke($frame, [ $frame_class->getField("EXIT_ON_CLOSE")->get($frame) ]);

// ...
$frame_class->getMethod("setSize", [ 
	ReflectionTypes::typeInt(), // getting ReflectionClass for int (int.class)
	ReflectionTypes::typeInt() 
])->invoke($frame, [ 
	ReflectionTypes::toInt(300), // cast jPHP float to ReflectionObject(int)
	ReflectionTypes::toInt(300)
]);

$pane = $frame_class->getMethod("getContentPane", [])->invoke($frame, []); // getting ReflectionObject(java.awt.Container)
$pane_class = ReflectionClass::forName("java.awt.Container"); // ReflectionClass for java.awt.Container

$button_class = ReflectionClass::forName("javax.swing.JButton");
$button = $button_class->getConstructor([ ReflectionClass::forName("java.lang.String") ])->newInstance([ "Test swing button!" ]);

$pane_class->getMethod("add", [ ReflectionClass::forName("java.awt.Component") ])->invoke($pane, [ $button ]); // ReflectionObject casts to java.lang.Object

$frame_class->getMethod("setVisible", [ ReflectionTypes::typeBool() ])->invoke($frame, [ true ]);

About

Java Bridge for jPHP

Resources

Readme
License
Activity
Custom properties

Stars

2 stars

Watchers

0 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.