Is there another way to extends two classes?

hi
I was wondering if anyone knows how to have one class to inherit two other classes methods?
I know that extending the main class with the two other classes are an invalid, just wondering is there another alternative to solve this problem?
Thank
J

I don't know the MHP class, but you could do the following:
if MHP.Button inherits feom awt.Button you may not have anything to do except change the constructor. You will be able to assign an MHP Button to an awt reference.
If MHP button is a truly seperate class, create an Interface with all the button methods you use. Then create a subclass of the MHP button which implements the interface and an awt subclass. Both these subclasses will be assignable to your interface reference.
I have done this with a button and JButton below. Of course this was not strictly necessary in this case because JButton extends from the awt Button class.
package package4;
import javax.swing.*;
import java.awt.*;
interface MyButton {
    // add ALL the rest of the methods you use!
    void setText(String txt);
    void show();
class myJButton extends JButton implements MyButton {
class myAWTButton extends Button implements MyButton {
    // AWTButton and JButton not quite compatible - call different function
    public void setText(String str) {
      setLabel(str);
public class Class2 extends Object {
   JFrame myframe ;
   MyButton button;
   JPanel jp;
  public Class2() {
    myframe = new JFrame() ;
    jp = new JPanel();
    myframe.setSize(500,500);
    myframe.setVisible(true);
    myframe.getContentPane().add(jp);
  void addJButton() {
    button = new myJButton();
    button.setText("DEFAULT");
    jp.add( (Component) button);
  void addAWTButton() {
    button = new myAWTButton();
    button.setText("DEFAULT");
     jp.add( (Component) button);
  void setButtonText(String str)
      button.setText(str);
  public static void main(String[] args) {
    Class2 awt = new Class2();
    awt.addAWTButton();
    awt.myframe.show();
    Class2 swing = new Class2();
    swing.addJButton();
    swing.myframe.setLocation(500,0);
    swing.myframe.show();
      // now we can use the same method on both
      swing.setButtonText("SWING!!!");
      awt.setButtonText("AWT!!!");
}In practice you would probably have a factory mettod to produce each type of button.

Similar Messages

  • My old IMAC is a few years old.  Just bought a new one OX 10.8.2.  The old one is  OS X 10.5.8.  Can I install Lion or ewuivalent and then synch both on ICLOUD.  Or is there another way to synch the two computers.

    My old IMAC is a few years old.  Just bought a new one OS X 10.8.2.  The old one is  OS X 10.5.8.  Can I install Lion or equivalent and then synch both on ICLOUD.  Or is there another way to synch the two computers.

    You can use Migration Assistant in Applications > Utilities to get all your files from one iMac to the other. If you want to upgrade your older model to MtLion you need to have at least a mid 2007 Intel Core 2 Duo with a bare minimum of 2GB of RAM. Then you need to buy the Snow Leopard 10.6.3 DVD , update with
    Mac OS X 10.6.8 Update Combo v1.1
    at which point you can access the App Store to purchase and install MtLion 10.8 where you would then have access to the iCloud.

  • Is there a way to have two separate projects open in different windows?

    On my old editing software, I could have two separate projects open at the same time. I could copy clips from Project A, click over to Project B, and paste the Project A clips to Project B. Is there a way to have two separate projects open with Premiere Elements, or will I have to just import and trim every clip within the same project?

    Welcome to the forum.
    Unfortunately, PrE will not allow two Projects to be open at the same time. It will also not allow multiple instances of PrE to be open.
    The workaround, to accomplish what you describe, is to use a ClipBoard Extender, such as ClipMate, which will allow one to Copy a Timeline, or parts of it, from one Project, then Close that one, to Open another one, and Paste the material, that was Copied. Many users employee ClipMate, or similar, to Copy/Paste material from one Project, to another.
    Good luck,
    Hunt

  • Data Sets - Is there a way to put two fields in the same row?

    I am working on my first Spry Data Set (in Dreamweaver CS4) which, if I can get it figured out, will eventually be used as a calendar on a client's web site. You can see the beginning of the project here:
    http://www.rieradesignco.com/calendarlist_spry.html
    My question is, can I put two or more fields on one row? Specifically, I would like the part that looks like this...
    3
    [WED]
    Fusion
    ... to look like this:
    3   [WED]   Fusion
    I tried simply moving the fields (in Design View) so that they looked like they would be in the same row, but as you can see, that didn't do the trick. (You can see what I did here, in the highlighted part of the screenshot:  http://www.rieradesignco.com/spryquestion.jpg). I also tried nesting a table within the table on my html data document that contained the three fields I needed - it worked okay, but that just makes the table more difficult to work with. I don't want to simply type the three items into one field, because it will be a long list and they all need to line up perfectly.
    Is there another way to do it?

    Change the following line to include the red coloured parts
    <div class="MasterColumn" spry:repeat="ds4" spry:setrow="ds4" spry:hover="MasterColumnHover" spry:select="MasterColumnSelected">
      <span>{Dsp_#}</span><span>{Dsp_WkDay}</span><span>{Dsp_Event}</span>
    </div>
    The add the following style rule to your document:
    .MasterColumn span {
        display: inline-block;
    I hope this helps.
    Ben

  • Wifi signal from Airport Extreme doesn't reach all areas of my house.  Is there a way to extend it without sacrificing bandwidth?  Airport Extreme version 7.6.1

    The wifi signal from my Airport Extreme doesn't reach all areas of my house.  Is there a way to extend it without sacrificing bandwidth?  I have an Airport Extreme running version 7.6.1.

    You will need to add another device like an AirPort Extreme to provide additional wireless coverage in the house.
    The only way to preserve bandwidth on a network would be to connect the two AirPort Extremes using an Ethernet cable connection.
    While you can "extend" using wireless only, typically half of the bandwidth on the network is sacrificed when you do this.

  • Is there a way to connect two analog mics recording in stereo to the iPad for recording?

    I currently use an M-Audio Mobile Pre to connect two microphones to my MacBook Pro via USB. If I wanted to use my iPad (or even iPhone) instead, is there a way to get the stereo input into the iPad? Would the Line 6 Sonic Port sold via Apple work? Would it take 2 separate inputs and deliver stereo to Garage Band or another recording app? Or is there another way?

    Exactly that -- the procedure is described in the online Help: InDesign Help | Text variables
    Now every time you insert the variable named "# of potatoes", you'll see the text "50" appear (with a minimal rectangular marker to indicate it's a variable), and when you want another number of potatoes, all you have to do is adjust the text in the Variables dialog.

  • Is there any way of extending a polynomial trendline in Numbers '09?

    Hi,
    The question title says it all really.  Is there any way of extending a polynomial trendline in Numbers '09, beyond the data that I currently have?  I can do this in Excel, but would like to be able to do this in Numbers too.
    Thanks,
    Nick

    Unfortunately there is no "forecast" feature for trendlines in Numbers. Wayne showed how to use the trendline equation from the chart to create additional data points for the chart.  This is by far the simplest way to do it in Numbers but it has two drawbacks:
    If your data changes, you'll need to manually readjust the coefficients for your forecasted point(s).
    The precision of the coefficients is only three decimal places. The forecasted Y values using these coefficients might not be as accurate as you would like. For example, compare the forecasted Y value in Wayne's table at X=20 to the one in the table below.
    You can avoid both problems by calculating the trendline coefficients in your table using the LINEST function. it is a little more work in the setup but it might save you time in the long run if your data changes a lot. Here is an example of for 2nd order polynomial:
    The last "real" data point is in row 10.
    Formula for column D =A
    Formula for column E =A*A
    F2 = the coefficient for X^2 =INDEX(LINEST(B2:B10,D2:E10),1)
    G2 = the coefficient for X =INDEX(LINEST(B2:B10,D2:E10),2)
    H2 = the constant =INDEX(LINEST(B2:B10,D2:E10),3)
    Note: If you later need to add an additional data point at the end of your data, go to the last row of your data (in this example it is row 10) and "add row below".  This way the formulas for the coefficients will adjust automatically to include the new row.

  • In Firefox 10, is there a way to add two "Open a new tab" buttons like in Firefox 3.6?

    In Firefox 10, is there a way to add two "Open a new tab" buttons like in Firefox 3.6?

    This UI change is really stupid and useless. People got used to some specified menu items order. Changing this order could only annoy and anger.
    Also the reload button has been relocated. This is another example of stupid Firefox 4 UI change. The good news is that it could easily be relocated to its original place.
    It looks like the Firefox developers are suffering from idleness and boredom.
    CHANGE IT BACK ASAP!!!

  • Is there another way to open a different iPhoto library?

    Is there another way to open a different iPhoto library besides using the option key and clicking on the iPhoto icon? It takes me upwards of a dozen times to get it to work, so I get that screen where I choose which library I want to open - the option key usually just doesn't respond. And since it takes several seconds for my main iPhoto library to shut down everytime it incorrectly opens up, it ends up taking me upwards of a few minutes, and a lot of frustration, by the time the option key suddenly decides to randomly work and I can choose the other library I want. This is iPhoto '09, version 10.6.8, by the way.
    Thanks!

    Of course I understand about double-clicking. but how can I double-click to choose the name of the iPhoto library I want when I cannot reliably get the menu option screen listing my two libraries to come up. As far as where the two libraries are actually stored on my computer, I haven't a clue - I just created the libraries on that iphoto library menu screen at some point in the past when I was setting it up. Is there some other place I could navigate to via Finder to select the library I want? I just don't think I need to spend $20 on software that I don't need - if I has lots of libraries, sure, but most of the time I use just the one library. But it's driving me crazy that when I do switch, I m having such difficulty.
    Thanks :)

  • Is there a way of extending the no of minutes afte...

    Is there a way of extending the no of minutes after scheduled end of program to record?   My Wife has Call The Midwife on series record and every week she loses the last few mins of the program???
    Anyone else having similar problems?
    Many Thanks
    Kim

    If you are recording from BBC1 (channel 1) then the box should handle it automatically using the start/stop signals that are broadcast (EIT p/f).
    If you are recording from BBC 1 HD (101) this is a multicast Extra TV channel and you can adjust the end padding in Settings.
    However, both systems only work if the box has a tuner available. For example, if it finishes at 9pm Sunday and two other recordings start at the same time the box will have to decide what to do and should end the first recording at exactly 9pm so it can start the others. This is OK providing the programme doesn't run late - if it does you'll miss the end off he recording. All boxes have this problem.
    I wouldn't expect the BBC to overrun on this though - they are normally better than other broadcasters.
    It would be interesting to know if you do have any recordings around 9pm - do let us know. If this is the problem then see if you can record the 9pm programmes at a different time (eg if they are broadcast again later).

  • Would crtl+f work or is there another way to search or quickly hyperlink to different sections on the page?

    We have a very long extended data tab full of custom sections and we would like to be able to give a user a way to search the page quickly.
    Would crtl+f work or is there another way to search or quickly hyperlink to different sections on the page?

    I don't know enough about your use case to provide specific direction but you may be able to use the 6.1.1 UI extensibility point.  For example, you could add an anchor link collection control that scrolls the page to the top of each section when selected. 

  • Is there a way to combine two itunes accounts?

    Is there a way to combine two seperate itunes accounts into one?  My husband and I both have itunes accounts and we want to combine into one.  Is this possible yet?  How do I do this?  Thanks! 

    It's not currently possible to combine iTunes accounts or to transfer content from one account to another account. You should be able to have both accounts authorised on the computer's iTunes that you sync to (via the Store > Authorise This Computer menu option) - but the apps will remain tied to the account that originally bought/downloaded it, so only that account will be able to download updates to those apps.
    Also note that using iTunes match, using automatic downloads or re-downloading past purchases will risk tying that computer (or device) to that account for 90 days : http://support.apple.com/kb/HT4627

  • Is there a way to know if class field is an array (reflection) ?

    Hi, everyone,
    Like subject says, is there a way to know if class field
    is an array and instance ? I suppose, reflection could
    help with that, but don't know exactly.
    I have a class:
    public class A {
    public B b[];
    //other fields
    B is another class.
    public class B {
    public C c;
    //other fields
    So, it is important for me to know if class A field b
    is an array and instance.
    Oh, and one more thing, how to initialize instance b
    through class A using reflection (i suppose), and to
    go through class B, and again get information about
    what fields and what are they (are they instances,
    arrays and so on). The same thing with class C ...
    I mean, if class (like A) has an instance b, i would
    like to get all information, if class B of this instance
    b has its own instances, and so on. And additionally,
    as mentioned above, i'd like to know if these instances
    (like b) are arrays.
    I think you got whole idea - how to go through class
    hierarchy and get information about class fields
    (instances esspecially).
    If someone knows, please reply.
    Thanks in advance.

    Thanks, that'll do for finding out if instance is
    an array.
    I know that my subject line doesn't sound quite right,
    sorry :)
    But there is more things i need information about.

  • HT5299 Is there a way to extend a thunderbolt cable?

    Is there a way to extend a thunderbolt cable? i.e.: 2 thunderbolt/displayport to hdmi adapters with an hdmi cable in between?

    No, but long Thunderbolt cables may be available soon.
    <http://appleinsider.com/articles/13/01/08/cornings-thunderbolt-and-usb-optical-c ables-transmit-data-over-hundreds-of-feet>
    3 meter cables are available now.
    <http://ca.startech.com/Cables/Thunderbolt-Cables/3-Meter-Thunderbolt-Cable-Male- to-Male~TBOLTMM3M>
    You don't need to extend the Thunderbolt display's cable.  You can connect to the computer using a long cable from the display's Thunderbolt port.
    If you do need to connect two Thunderbolt cables, use a Thunderbolt disk drive with two Thunderbolt ports.

  • ColdFusion f*cked up, database driven websites, is there another way?

    Hi there,
    I downloaded a trial version of ColdFusion from Adobe, and it won't ever let me setup, and it doesn't let me uninstall. It asks for my OS X login password, I typed it in correctly, and it always comes out wrond. Don't ask me if I did type it in wrongly, cus I didn't . I tried logging out and ten back in again. Adobe are probably a con, they don't let you uninstall software off YOUR computer. So, I was wondering, is there another way to make database driven websites on your Mac without using con company software like Adobe? If somebody can sort out the Adobe problem, I would be really appriciate it.
    Thanks!

    Ok, first of all you need to understand this entire process from installing the server apps, to writing the code, to laying out the page isnt going to be a simple drag and drop, point and click, upload and go process. Its going to be ALOT more involved than that on any operating system and in any development environment. I dont ever want to discourage, but im going to let you know right now if you have this attitude of "it didnt work in the first 10 minutes" you aint gonna end up creating anything. Period.
    That said, you need to consider where youre going to run this site. Are you going to run it off your home computer? Ok, then youll need a static ip address to bind to your domain name and at the leat a always on broadband connection - preferably a business account if you want to avoid being haslted by your ISP. If youre going to host the site somewhere then you need to lok at what type of server its going to run n and what technlogies are going to be available on that server. The most common are ASP/ASP.Net and PHP4.In combonation with MSSQL, MySQL or Postgre. You cant really run ASP on your mac since its an MS only thing (ALthough ther eis a Java server that will run ASP available from Sun Microsystems). So now youre left with PHP out of those two. Ofcourse, you can find hosts offering hosted Coldfusion and Ruby on Rails. However rails can be tricky to get working on a mac properly so id say youll probably jsut want to stick with PHP. Id reccommend php4 as opposed to php5 since most hosts arent yet offering php5(this is changing daily but for the time being in a learning environment jsut use 4).
    As for MySQL, agian you need to use in your environment the one youre using on your host. So stick with verion 4.x.x as thats what most hosts currently run... Mine still runs 3.x.x although tats set to change to 4.x.x by the end of the year.
    One thing youll learn in web development is that people dont always use the most recent generally available rleas of a product, particularily where opensource stuff is concerned.

  • Can I put more than one user under one Apple ID account. I want to let other family members use imessage on their own Apple device. Or is there another way to get this end result?

    Can I put more than one user under one Apple ID account. I want to let other family members use imessage on their own Apple device. Or is there another way to get this end result?

    You can seach the net for solutions like this one http://appletvvpn.com/how-to-connect-apple-tv-2-to-vpn/ another idea is to use a PC as the control and fit that with a wireless card and set up a ad hoc wireless network that the Apple TV uses. 

Maybe you are looking for

  • How to setup multiple content servers on one host

    Hi, We have setup 2 ECC 6.0 systems on one host ECC DEV and ECC QAS. Windows 2003 Server 64bit We want to setup 2 standalone Content Servers (MaxDB). One contentserver pointing to ECC DEV and one to ECC QAS. Containing its own content. Problem is tha

  • Add feature - assembly could not be found error 0x80073701

    I am trying to install the SNMP service on this server - succesfully did this on an identical server. Windows reports back "The request to add or remove features on the specified server failed. The reference assembly could not be found. Error 0x80073

  • Getting ARD to see an iMac behind Airport Express

    I have a client that has bought an iMac and is connected to the internet using Airport Express (adsl modem is connected to express with ethernet cable, and modem is connected to the telephone line, problem is that when I am in my studio and try to co

  • Gapless album transistion feature doesn't work

    I normally have the "crossfade" feature turned on when listening to playlists. However, I have several songs in my itunes library that have cold endings. I do not want to crossfade these songs. The "Part of a Gapless Album" feature  (get info>options

  • After the latest update i lost iPhoto!!

    AND I WANT IT BACK. Photos is awful.   It does not do the editing job that iPhoto did at ALL.  I do not want Instagram!  I already have instagram on my phone, why do I need some funky app that does stupid filters? Not only that, how can Apple delete