Java - Calling a public method (not public void)
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , I have this code but I am unsure how to call the public create() method with the public static void main(String[] args) method in a different class. I have searched the net but found nothing on just public methods just public void methods. , That is actually a constructor. You call it with new. create panel = new create();
|
Calling the contents of public static void main in another class
Tag : java , By : cthulhup
Date : March 29 2020, 07:55 AM
I wish did fix the issue. I have the classes Embed.java and watermarkdemo.java public void actionPerformed(ActionEvent e) {
...
Embed.main(null); // or a String[] containing args you want to pass
...
}
|
Calling a Controller class public Void method for another Controller class
Tag : chash , By : Nandor Devai
Date : March 29 2020, 07:55 AM
it helps some times Using helper methods from other controllers is a bad practice/design in my opinion. You should refactor such methods to an helper class which can be accessed from both controllers. Trivial example: public static ViewDataHelpers
{
public static void PopulateViewData(IEnumerable<VM> vms)
{
// ...
}
}
ViewDataHelpers.PopulateViewData(viewModels);
public static void PopulateViewData(this IEnumerable<VM> vms)
{
// ...
}
viewModels.PopulateViewData();
|
what is wrong with this code public class Hello { public static void main() { System.out.println("Doesn't execute&q
Tag : java , By : cautionsign
Date : March 29 2020, 07:55 AM
|
How to calling text in public void PassValue(string) to private void Form1_Load()
Date : March 29 2020, 07:55 AM
it helps some times I need some help. There is a text "Hello" (strvalue = "Hello") in , You can store it as a member variable and then set it when required: private string m_StrValue;
private void Form1_Load(object sender, EventArgs e)
{
label1.text = m_StrValue;
}
public void PassValue(string strValue )
{
m_StrValue = strValue;
}
|